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

Re: [PATCH 4/4] gc: remove broken refs

From
Jeff King <peff@peff.net>
Date
Sep 25, 2015, 01:35 UTC
Message-ID
<20150925013537.GA7522@sigill.intra.peff.net>
In-Reply-To
<xmqqr3lnuzqu.fsf@gitster.mtv.corp.google.com>
On Thu, Sep 24, 2015 at 05:08:41PM -0700, Junio C Hamano wrote:
Show 22 quoted lines
> One thing I wondered was if we can reliably tell between a ref that
> wanted to be a real ref that records a broken object name and a ref
> that wanted to be a symbolic ref that points a bogus thing, and if
> we can't, should we worry about it too much.  The former is more
> serious, as the history behind the commit it wanted to but failed to
> record is at risk of being pruned.
> 
> One case that is clearly safe is "ref: refs/heads/gone"; it is not
> likely to be the result of attempting to write a real object name
> gone bad by whatever filesystem corruption.  On the other hand, an
> obviously problematic case is an empty file.  We cannot tell if the
> "broken" ref used to anchor the tip of a real history (which is
> about to be lost with Dscho's patch 1/4) or was merely pointing at
> another ref (which will not harm the object database if ignored).
> 
> So the rule should be
> 
>     If resolve_ref_unsafe_1() says it is a symbolic ref, if
>     check_ref_format() is OK with the ref it points at, and if that
>     pointee is missing, then it is safe to skip.
> 
> All other funnies should trigger the safety.

Right, I agree with that rule. If we don't know what it is, we should err on the conservative side (and that _shouldn't_ happen, because does not generate files in .git/refs that it cannot itself understand). But "ref: " is clearly something we understand.

-Peff
Previous: Junio C HamanoNext: Johannes Schindelin
Message 10 of 28 in “Fix gc failure when a remote HEAD goes stale”
  1. 0/4 Fix gc failure when a remote HEAD goes staleJohannes Schindelin, Sep 24, 2015
  2. 1/4 gc: demonstrate failure with stale remote HEADJohannes Schindelin, Sep 24, 2015
  3. 2/4 pack-objects: do not get distracted by stale refsJohannes Schindelin, Sep 24, 2015
  4. Jeff KingSep 24, 2015
  5. 3/4 mark_reachable_objects(): optionally collect broken refsJohannes Schindelin, Sep 24, 2015
  6. Jeff KingSep 24, 2015
  7. 4/4 gc: remove broken refsJohannes Schindelin, Sep 24, 2015
  8. Jeff KingSep 24, 2015
  9. Junio C HamanoSep 25, 2015
  10. Jeff KingSep 25, 2015
  11. 0/4 Fix gc failure when a remote HEAD goes staleJohannes Schindelin, Sep 28, 2015
  12. 1/4 gc: demonstrate failure with stale remote HEADJohannes Schindelin, Sep 28, 2015
  13. 2/4 pack-objects: do not get distracted by broken symrefsJohannes Schindelin, Sep 28, 2015
  14. 3/4 mark_reachable_objects(): optionally collect broken symrefsJohannes Schindelin, Sep 28, 2015
  15. 4/4 gc: remove broken symrefsJohannes Schindelin, Sep 28, 2015
  16. Junio C HamanoSep 28, 2015
  17. Junio C HamanoSep 28, 2015
  18. Johannes SchindelinSep 28, 2015
  19. Junio C HamanoOct 5, 2015
  20. Jeff KingSep 28, 2015
  21. Johannes SchindelinSep 28, 2015
  22. 0/2 Fix gc failure when a remote HEAD goes staleJohannes Schindelin, Oct 6, 2015
  23. 1/2 gc: demonstrate failure with stale remote HEADJohannes Schindelin, Oct 6, 2015
  24. 2/2 pack-objects: do not get distracted by broken symrefsJohannes Schindelin, Oct 6, 2015
  25. Junio C HamanoOct 7, 2015
  26. Johannes SchindelinOct 8, 2015
  27. Junio C HamanoOct 8, 2015
  28. Johannes SchindelinOct 8, 2015

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.