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

Re: [PATCH 2/4] remote: handle broken symrefs

From
Jeff King <peff@peff.net>
Date
Oct 19, 2017, 17:53 UTC
Message-ID
<20171019175315.aewiewjk3fvhifa4@sigill.intra.peff.net>
In-Reply-To
<20171019174730.urelfyc2kj37fokg@sigill.intra.peff.net>
On Thu, Oct 19, 2017 at 01:47:30PM -0400, Jeff King wrote:
Show 9 quoted lines
> This is hard to trigger in practice, since this function is
> used as a callback to for_each_ref(), which will skip broken
> refs in the first place (so it would have to be broken
> racily, or for us to see a transient filesystem error).
> 
> If we see such a racy broken outcome let's treat it as "not
> a symref". This is exactly the same thing that would happen
> in the non-racy case (our function would not be called at
> all, as for_each_ref would skip the broken symref).

The fact that we have to re-resolve the ref here to find the symref points to a short-coming in the for_each_ref() interface. It resolved the ref already to get us the oid, so it should (or at least could) know the symref details already. But it doesn't record them or make them available to callers.

Ditto for patch 3. It doesn't use for_each_ref(), but I suspect it could be recording the value of HEAD more carefully from the prior lookup, avoiding the re-resolution completely.

Refactoring for_each_ref() is probably a bit big for a #leftoverbits, but looking into the case in patch 3 might not be.

-Peff
Previous: Jeff KingNext: Jeff King
Message 10 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.