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

[PATCH 0/4] get_oid: cope with a possibly stale loose object cache

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 13, 2019, 10:16 UTC
Message-ID
<pull.161.git.gitgitgadget@gmail.com>

Being rather a power user of the interactive rebase, I discovered recently that one of my scripts ran into an odd problem where an interactive rebase appended new commands to the todo list, and the interactive rebase failed to validate the (short) OIDs. But when I tried to fix things via git rebase --edit-todo, the interactive rebase had no longer any problem to validate them.

Turns out that I generated the objects during the interactive rebase (yes, I implemented a 2-phase rebase [https://github.com/git-for-windows/build-extra/blob/master/ever-green.sh]), and that their hashes happened to share the first two hex digits with some loose object that had already been read in the same interactive rebase run, causing a now-stale loose object cache to be initialized for that .git/objects/?? subdirectory.

It was quite the, let's say, adventure, to track that one down.

Over at the companion PR for Git for Windows [https://github.com/git-for-windows/git/pull/2121], I discussed this with Peff (who introduced the loose object cache), and he pointed out that my original solution was a bit too specific for the interactive rebase. He suggested the current method of re-reading upon a missing object instead, and explained patiently that this does not affect the code path for which the loose object cache was introduced originally: to help with performance issues on NFS when Git tries to find the same missing objects over and over again.

The regression test still reflects what I need this fix for, and I would rather keep it as-is (even if the fix is not about the interactive rebase per se), as it really tests for the functionality that I really need to continue to work.

My only concern is that this might cause some performance regressions that neither Peff nor I could think of, where get_oid() may run repeatedly into missing objects by design, and where we should not blow away and recreate the loose object cache all the time.

Does anybody share this concern? Or even better: can anybody think of such a scenario?

Johannes Schindelin (4):
  rebase -i: demonstrate obscure loose object cache bug
  sequencer: improve error message when an OID could not be parsed
  sequencer: move stale comment into correct location
  get_oid(): when an object was not found, try harder
 sequencer.c                 |  5 +++--
 sha1-name.c                 | 12 ++++++++++++
 t/t3429-rebase-edit-todo.sh | 22 ++++++++++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)
base-commit: e902e9bcae2010bc42648c80ab6adc6c5a16a4a5
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-161%2Fdscho%2Frereading-todo-list-and-loose-object-cache-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-161/dscho/rereading-todo-list-and-loose-object-cache-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/161
-- 
gitgitgadget
Next: Johannes Schindelin via GitGitGadget
Message 1 of 32 in “get_oid: cope with a possibly stale loose object cache”
  1. 0/4 get_oid: cope with a possibly stale loose object cacheJohannes Schindelin via GitGitGadget, Mar 13, 2019
  2. 1/4 rebase -i: demonstrate obscure loose object cache bugJohannes Schindelin via GitGitGadget, Mar 13, 2019
  3. Ævar Arnfjörð BjarmasonMar 13, 2019
  4. Jeff KingMar 13, 2019
  5. Jeff KingMar 13, 2019
  6. Johannes SchindelinMar 13, 2019
  7. Jeff KingMar 14, 2019
  8. Johannes SchindelinMar 13, 2019
  9. Jeff KingMar 14, 2019
  10. Johannes SixtMar 14, 2019
  11. Johannes SchindelinMar 14, 2019
  12. Junio C HamanoMar 14, 2019
  13. Johannes SchindelinMar 14, 2019
  14. 2/4 sequencer: improve error message when an OID could not be parsedJohannes Schindelin via GitGitGadget, Mar 13, 2019
  15. Junio C HamanoMar 14, 2019
  16. 4/4 get_oid(): when an object was not found, try harderJohannes Schindelin via GitGitGadget, Mar 13, 2019
  17. Junio C HamanoMar 14, 2019
  18. Jeff KingMar 14, 2019
  19. Jeff KingMar 14, 2019
  20. Junio C HamanoMar 14, 2019
  21. Jeff KingMar 14, 2019
  22. Junio C HamanoMar 14, 2019
  23. Johannes SchindelinMar 14, 2019
  24. Jeff KingMar 14, 2019
  25. Johannes SchindelinMar 14, 2019
  26. 3/4 sequencer: move stale comment into correct locationJohannes Schindelin via GitGitGadget, Mar 13, 2019
  27. Jeff KingMar 13, 2019
  28. 0/4 get_short_oid: cope with a possibly stale loose object cacheJohannes Schindelin via GitGitGadget, Mar 14, 2019
  29. 1/4 rebase -i: demonstrate obscure loose object cache bugJohannes Schindelin via GitGitGadget, Mar 14, 2019
  30. 2/4 sequencer: improve error message when an OID could not be parsedJohannes Schindelin via GitGitGadget, Mar 14, 2019
  31. 3/4 sequencer: move stale comment into correct locationJohannes Schindelin via GitGitGadget, Mar 14, 2019
  32. 4/4 get_oid(): when an object was not found, try harderJohannes Schindelin via GitGitGadget, Mar 14, 2019

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.