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

Re: [PATCH 2/2] index-pack: handle duplicate base objects gracefully

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 31, 2014, 22:23 UTC
Message-ID
<xmqq38cc47tp.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140831152437.GB17449@peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> Broken ident lines are annoying, but not _too_ fundamentally bad.
> Duplicate tree entries are a lot worse. Fsck even distinguishes between
> "error" and "warning", but "index-pack --strict" treats both as a reason
> to reject the object. We could perhaps loosen that, and make sure our
> error/warning categories are reasonable.

A pack stream that records the same object twice is not a breakage that is buried deep in the history and cannot be corrected without a wholesale history rewrite, unlike commit objects with broken ident lines or tree objects with 0-filled file type designators.

As such, I think it is a reasonable thing to do the following:
 - "git repack" should be taught to dedup, as a way to recover from
   such a breakage, if not done already.
 - "git fsck" should complain, suggesting users to repack to
   recover.  It may even want to exit with non-zero status.
 - "git receive-pack" and "git fetch-pack" should warn, loudly,
   without failing.  They should ideally not keep such a corrupt
   pack stream on disk at all, de-duping the objects while
   streaming, but if that is not practical, at least they should
   give an easy way for the user to cause de-duping immediately (I
   do not mind if that is "we detected that the other side fed us a
   pack stream that is broken.  We automatically correct the
   breakage for you by repacking.  Be patient while we do so").
 - If the other side of "receive-pack/fetch-pack" implements the
   agent capability, upon detecting such a breakage, it may not be a
   bad idea to offer the user to send an e-mail reporting the
   version of the software to a wall-of-shame e-mail address ;-).

I agree that a tree that records the same path twice should be outright rejected. There is no sane recovery path.

Previous: Jeff KingNext: Jeff King
Message 26 of 30 in “[BUG] resolved deltas”
  1. Petr StodulkaAug 21, 2014
  2. Petr StodulkaAug 21, 2014
  3. Martin von GagernAug 22, 2014
  4. René ScharfeAug 23, 2014
  5. Jeff KingAug 23, 2014
  6. Jeff KingAug 23, 2014
  7. Jeff KingAug 23, 2014
  8. René ScharfeAug 25, 2014
  9. Jeff KingAug 28, 2014
  10. Jeff KingAug 28, 2014
  11. Jeff KingAug 28, 2014
  12. Jeff KingAug 28, 2014
  13. Junio C HamanoAug 28, 2014
  14. Jeff KingAug 29, 2014
  15. 1/2 index-pack: fix race condition with duplicate basesJeff King, Aug 29, 2014
  16. 2/2 index-pack: handle duplicate base objects gracefullyJeff King, Aug 29, 2014
  17. Junio C HamanoAug 29, 2014
  18. Jeff KingAug 29, 2014
  19. Shawn PearceAug 30, 2014
  20. Jeff KingAug 30, 2014
  21. René ScharfeAug 30, 2014
  22. Jeff KingAug 31, 2014
  23. René ScharfeAug 31, 2014
  24. Shawn PearceAug 31, 2014
  25. Jeff KingAug 31, 2014
  26. Junio C HamanoAug 31, 2014
  27. 3/2 t5309: mark delta-cycle failover tests as passingJeff King, Aug 30, 2014
  28. Jeff KingAug 31, 2014
  29. Junio C HamanoSep 2, 2014
  30. Shawn PearceAug 25, 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.