Re: http-protocol question
- From
Bryan Turner <bturner@atlassian.com>
- Date
- Dec 2, 2014, 04:28 UTC
- Message-ID
- <CAGyf7-GZbRBN4O_yNgrmJCya=6f8XQ4O8m7WBa1k8Ve196ajYQ@mail.gmail.com>
- In-Reply-To
- <20141202033416.GY6527@google.com>
On Tue, Dec 2, 2014 at 2:34 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 9 quoted lines
> Hi Bryan, > > Bryan Turner wrote: > >> Is there actually logic somewhere in Git that does that "MAY walk >> backwards" step? > > Yes. See upload-pack.c::check_non_tip and > http://thread.gmane.org/gmane.comp.version-control.git/178814.
Jonathan,
Thanks for the reply! I realize now I didn't really cite the part of that documentation that I'm most interested in, which is: "through history _or through the reflog_". It's the reflog bit I'm looking for. Sorry for not being more clear. check_non_tip appears to look at ancestry, walking back up (or down, depending on your view) the DAG to see if the requested SHA-1 is reachable from a current ref, so it looks like that's covering the "through history" part of that blurb.
The reason I ask is that there is a race condition that exists where the ref advertisement lists refs/heads/foo at abc1234, and then foo is deleted before the actual upload-pack request comes in. In that situation, walking backwards through _history_ will only allow the upload-pack to complete unless the deleted ref was merged into another ref prior to being deleted (if I understand the code correctly). It seems like looking at the reflogs, and seeing that refs/heads/foo did in fact exist and did in fact refer to abc1234, is the only approach that could allow the upload-pack to complete. The documentation hints that such a thing is possible, but I don't see any code in Git that seems to do that.
Does that make more sense? Does that functionality exist and I've just overlooked it?
Thanks again, Bryan Turner
> > Hope that helps, > Jonathan