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

Re: [PATCH] commit: check result of resolve_ref_unsafe

From
Jeff King <peff@peff.net>
Date
Oct 19, 2017, 02:49 UTC
Message-ID
<20171019024919.ram3bzabt5fra2lc@sigill.intra.peff.net>
In-Reply-To
<xmqqo9p4j7eu.fsf@gitster.mtv.corp.google.com>
On Thu, Oct 19, 2017 at 09:41:29AM +0900, Junio C Hamano wrote:
Show 10 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Tangential to your patch, I also wondered why we did not pass
> > RESOLVE_REF_READING to resolve_ref_unsafe(). I think the answer is that
> > for symref lookups, we normally don't pass it so that we can handle
> > dangling symrefs. Of course we _just_ wrote HEAD ourselves, so we'd
> > expect it to exist, so it shouldn't really matter either way.
> 
> If we do expect it to exist, shouldn't we checking with READING and
> catching a funny situation if it arises?

Maybe. In the normal case it would not matter. If we _do_ find it gone, I guess that is a sign that somebody is racing with us and changed HEAD after we made the commit.

TBH, I think the "most right" thing would be to actually capture the ref that HEAD points to when we actually make the commit, remember it, and then report it here (the whole function of this code is just to say "I made a commit on branch X"). But I don't know how much trouble it is worth going to for that. It's buried behind a ref_transaction, and I don't think builtin/commit.c ever sees the real name (though maybe it would be a good feature of the transaction to record the destinations of any symrefs we updated).

-Peff
Previous: Junio C HamanoNext: Andrey Okoshkin
Message 4 of 20 in “commit: check result of resolve_ref_unsafe”
  1. commit: check result of resolve_ref_unsafeAndrey Okoshkin, Oct 18, 2017
  2. Jeff KingOct 18, 2017
  3. Junio C HamanoOct 19, 2017
  4. Jeff KingOct 19, 2017
  5. Andrey OkoshkinOct 19, 2017
  6. commit: check result of resolve_ref_unsafeAndrey Okoshkin, Oct 19, 2017
  7. Jeff KingOct 19, 2017
  8. 1/4 test-ref-store: avoid passing NULL to printfJeff King, Oct 19, 2017
  9. 2/4 remote: handle broken symrefsJeff King, Oct 19, 2017
  10. Jeff KingOct 19, 2017
  11. 3/4 log: handle broken HEAD in decoration checkJeff King, Oct 19, 2017
  12. 4/4 worktree: handle broken symrefs in find_shared_symref()Jeff King, Oct 19, 2017
  13. Eric SunshineOct 21, 2017
  14. Jeff KingOct 21, 2017
  15. Junio C HamanoOct 22, 2017
  16. Andrey OkoshkinOct 20, 2017
  17. commit: check result of resolve_ref_unsafeAndrey Okoshkin, Oct 20, 2017
  18. commit: check result of resolve_ref_unsafeAndrey Okoshkin, Oct 20, 2017
  19. Jeff KingOct 21, 2017
  20. Junio C HamanoOct 22, 2017

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.