Subject: Re: Clone from shallow bundle bug

From: Phillip Susi <[email-masked]>
Date: Tue, 31 Mar 2015 22:56:36 -0400

On 03/31/2015 06:17 PM, Junio C Hamano wrote:
> Phillip Susi <[email-masked]> writes:
> 
>> I made a shallow clone of my repo, then used git bundle create to
>> pack it all into a bundle file, then cloned from that bundle.
> 
> I think the introdution of shallow clone feature broke git bundle
> create by not teaching it that its shallow boundaries are
> prerequisite commits to unbundle its contents.  IOW, the bundle
> created from the shallow clone is broken, I would think.

It seems to me that it isn't exactly broken; it just needs to put
something in the bundle noting that it was built from a shallow clone,
and then when cloning from the shallow bundle, the new clone needs its
.git/shallow file.

In other words, the bundle contains all of the objects in the shallow
clone, so a new shallow clone can be correctly constructed from the
bundle, it's just that the new clone doesn't *know* it too is shallow
and things like git log and gitk need to stop following the history
chain when they reach the shallow point rather than complain that the
rest of the history is missing ( which is intentional ).

For that matter, if you do create a depth limited bundle from a non
shallow repository, then try to clone from it, the cloned repo should
automatically become shallow rather than complain about missing history.

In other words, any time you clone from a bundle, the clone process
should check if the full history is in the bundle, and if not,
automatically make the new repo shallow so as to avoid the error
messages about the missing history.