threads / discuss / 18415

Push tag from shallow clone?

Subject: Push tag from shallow clone?

## tl;dr

3 messages between Mar 19, 2009 and Mar 20, 2009.

replies: 2people: 2as markdown or json

skillzero@gmail.com· Mar 19, 2009, 17:56 UTC · lore

The documentation for git clone says that if you use --depth=1 to make a shallow clone that you can't push it. But I made a shallow clone, created a tag, then tried to push that tag and it worked. Am I just getting lucky or is it safe to push a tag with a shallow clone?

The reason I ask is that we have an automatic builder/tester/archiver where I'd like to make a shallow clone (to save space since it only needs the tip of the branch to do the build), do the normal build and test and if it all passes, tag it, and push the tag so people can pull tags that have been verified by the automated builder.

Shawn O. Pearce· Mar 19, 2009, 18:02 UTC · re: skillzero@gmail.com · lore

Re: Push tag from shallow clone?

skillzero@gmail.com wrote:
> The documentation for git clone says that if you use --depth=1 to make
> a shallow clone that you can't push it. But I made a shallow clone,
> created a tag, then tried to push that tag and it worked. Am I just
> getting lucky or is it safe to push a tag with a shallow clone?

Yea, you are getting lucky. The tag is easily identified as one object head of the current branch on the remote, and the client is able to produce the pack and send it.

If the remote branch gets modified in the interm, the builder may not be able to deduce what it needs to send, and will attempt to pack a lot more data, potentially finding the missing parents from where it is shallow.

Why not just have a central area on the build server that keeps full clones of everything, and use "git clone -s" or "git clone --reference" in order to create the new work area for the builder?

-- 
Shawn.
skillzero@gmail.com· Mar 20, 2009, 00:01 UTC · re: Shawn O. Pearce · lore

Re: Push tag from shallow clone?

On Thu, Mar 19, 2009 at 11:02 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 18 quoted lines
> skillzero@gmail.com wrote:
>> The documentation for git clone says that if you use --depth=1 to make
>> a shallow clone that you can't push it. But I made a shallow clone,
>> created a tag, then tried to push that tag and it worked. Am I just
>> getting lucky or is it safe to push a tag with a shallow clone?
>
> Yea, you are getting lucky.  The tag is easily identified as one
> object head of the current branch on the remote, and the client is
> able to produce the pack and send it.
>
> If the remote branch gets modified in the interm, the builder may
> not be able to deduce what it needs to send, and will attempt to
> pack a lot more data, potentially finding the missing parents from
> where it is shallow.
>
> Why not just have a central area on the build server that keeps
> full clones of everything, and use "git clone -s" or "git clone
> --reference" in order to create the new work area for the builder?

Thanks for the info. As for using --reference, one of the things that the builder does is archive the build in its entirety so it can be reproduced later on a different machine. I'll probably just need to use a full clone (or do some kind of stripping after the build succeeds and before it archives).

← back to recent threads