git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Jonathan NiederNext: Bryan Turner
Message 3 of 14 in “http-protocol question”
  1. Bryan TurnerDec 2, 2014
  2. Jonathan NiederDec 2, 2014
  3. Bryan TurnerDec 2, 2014
  4. Bryan TurnerDec 2, 2014
  5. Jonathan NiederDec 2, 2014
  6. Bryan TurnerDec 2, 2014
  7. Jonathan NiederDec 2, 2014
  8. Duy NguyenDec 2, 2014
  9. Duy NguyenDec 2, 2014
  10. Jeff KingDec 2, 2014
  11. Bryan TurnerDec 2, 2014
  12. Jeff KingDec 2, 2014
  13. Junio C HamanoDec 2, 2014
  14. Jeff KingDec 2, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.