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

[PATCH 0/5] repack improvements

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Mar 20, 2009, 03:47 UTC
Message-ID
<t_s5aa51o2kq_ePRWgLTEkVg4HqH1dQa6_mVq4djPPG4Vxylm2hNqmx7fPC2W5AsfcXg83DYbGc@cipher.nrlssc.navy.mil>
In-Reply-To
<EblkEXbcYUWby1OEDup9n0l6lbwNL-4-jyt02Cjab2pqLqekAUji0w@cipher.nrlssc.navy.mil>

As I mentioned in a previous email, the recent changes to pack-objects/rev-list partially fixed one repacking flaw, but introduced 2 others. There were actually two emails, but the first one never made it to the list.

There existed a flaw that prevented repack from properly repacking objects contained in packs from alternate repositories if the local repository contained any non-kept packs. This was fixed by the --kept-pack-only feature, in exchange for not being able to pack objects contained in alternate packs which had a keep file. Since the user may not have control over the referenced object database, I think it is fair not to the honor the keep files in that case.

Additionally, if repack told pack-objects to loosen unreferenced objects, it would even loosen objects residing in alternate packs. They would then be immediately deleted by the call to prune-packed though.

The solution I chose is actually to fall back to the --honor-pack-keep option and to stop using the --kept-pack-only option. pack-objects already iterates over every object added for packing and searches the pack array to check whether it is already packed, so for the case where no keep files are used, there is actually one less iteration through the pack array for each commit. But one more (?) for each object referenced by a commit that is packed in a pack with a .keep file.

So this keeps the local and keep_pack decision making in pack-objects. The other way would be to move the --local option over into rev-list and teach the pack lookup machinery to differentiate between local and non-local packs. Not sure which is better, but this was easier.

I think there is still one case where an object will be loosened unnecessarily. If an unreferenced object exists in a local pack _and_ in an alternate object database, then I believe it will be loosened and then pruned. To fix it, loosen_unused_packed_objects and add_objects_in_unpacked_packs would have to iterate through the non-local packs to check whether they contained the object before loosening/repacking it. Probably won't happen often in practice though.

Also, I think the --kept-pack-only option is now not necessary. The last patch removes the --kept-pack-only feature /ducks and can be dropped if you think this feature may be useful in the future.

Brandon Casey (5):
  t7700-repack: add two new tests demonstrating repacking flaws
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  pack-objects: only repack or loosen objects residing in "local" packs
  t7700-repack: repack -a now works properly, expect success from test
  Remove --kept-pack-only option and associated infrastructure
 builtin-pack-objects.c |    5 ++---
 cache.h                |    1 -
 git-repack.sh          |    6 +-----
 revision.c             |    9 +--------
 revision.h             |    1 -
 sha1_file.c            |   21 +--------------------
 t/t7700-repack.sh      |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 7 files changed, 50 insertions(+), 39 deletions(-)
Previous: Brandon CaseyNext: Brandon Casey
Message 11 of 17 in “"git repack -a -d" improvements”
  1. 0/6 "git repack -a -d" improvementsJunio C Hamano, Feb 28, 2009
  2. 1/6 git-repack: resist stray environment variableJunio C Hamano, Feb 28, 2009
  3. 2/6 has_sha1_pack(): refactor "pretend these packs do not exist" interfaceJunio C Hamano, Feb 28, 2009
  4. 3/6 has_sha1_kept_pack(): take "struct rev_info"Junio C Hamano, Feb 28, 2009
  5. 4/6 Consolidate ignore_packed logic moreJunio C Hamano, Feb 28, 2009
  6. 5/6 Simplify is_kept_pack()Junio C Hamano, Feb 28, 2009
  7. 6/6 is_kept_pack(): final clean-upJunio C Hamano, Feb 28, 2009
  8. Kjetil BarvikFeb 28, 2009
  9. Junio C HamanoFeb 28, 2009
  10. Brandon CaseyMar 18, 2009
  11. 0/5 repack improvementsBrandon Casey, Mar 20, 2009
  12. 1/5 t7700-repack: add two new tests demonstrating repacking flawsBrandon Casey, Mar 20, 2009
  13. 2/5 git-repack.sh: don't use --kept-pack-only option to pack-objectsBrandon Casey, Mar 20, 2009
  14. 3/5 pack-objects: only repack or loosen objects residing in "local" packsBrandon Casey, Mar 20, 2009
  15. 4/5 t7700-repack: repack -a now works properly, expect success from testBrandon Casey, Mar 20, 2009
  16. 5/5 Remove --kept-pack-only option and associated infrastructureBrandon Casey, Mar 20, 2009
  17. Brandon CaseyMar 20, 2009

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.