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

[PATCH 0/6] "git repack -a -d" improvements

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 28, 2009, 09:15 UTC
Message-ID
<cover.1235812035.git.gitster@pobox.com>
In-Reply-To
<alpine.LFD.2.00.0902191318310.21686@localhost.localdomain>

This is series removes the linear search in "ignore_packed" list when "git repack -a -d" is run to consolidate many packfiles that are not marked to be kept with ".keep". It is oversplit for easier review; in the final form, I think it should be two patch series, 1/6 and the rest.

The current mechanism is to pass the name of packfiles that are not marked to be kept with --unpacked= command line option. This list is used to a few internal functions to pretend as if the objects found in named packs exist in loose form and subject to repacking. This look-up is linear and found to be very inefficient.

[1/6] is a preparatory and an unrelated bugfix to git-repack script.

[2/6] refactors public interface has_sha1_pack() that takes an optional "ignore_packed" list. Most callers pass NULL, so it introduces a new function has_sha1_kept_pack() and migrate the minority caller to this interface while losing the argument from the original function and callers that currently pass NULL.

[3/6] temporarily makes the the extra argument to has_sha1_kept_pack() function to pass "ignore_packed" list from a list of char* to a pointer to struct rev_info, solely to make the refactoring done in [4/6] easier to follow. Most of the effects of this patch will be removed at the end.

[4/6] identifies three places that use "ignore_packed" list to tell if a pack is on the list or not, and introduces a helper function to do so. The helper is conveniently called is_kept_pack(), even though at this stage the list does not necessarily mean a list of "unkept" packs yet.

[5/6] removes --unpacked=<packfile> parameter, and adds --kept-pack-only option. The sole user of --unpacked=<packfile>, git-repack, is updated to pass this option instead of listing the "unkept" packfiles on the command line.

[6/6] reverts most of the effects of [3/6] made solely for reviewability and removes is_kept_pack() helper function, which now is merely a lookup of a structure member "p->pack_keep".

I think we probably could get rid of --honor-pack-keep mechanism after this series, but I didn't look very deeply into it.

Junio C Hamano (6):
  git-repack: resist stray environment variable
  has_sha1_pack(): refactor "pretend these packs do not exist"
    interface
  has_sha1_kept_pack(): take "struct rev_info"
  Consolidate ignore_packed logic more
  Simplify is_kept_pack()
  is_kept_pack(): final clean-up
 builtin-count-objects.c |    2 +-
 builtin-fsck.c          |    2 +-
 builtin-pack-objects.c  |   14 ++--------
 builtin-prune-packed.c  |    2 +-
 cache.h                 |    4 +-
 diff.c                  |    2 +-
 git-repack.sh           |    6 ++++-
 revision.c              |   25 +++++++------------
 revision.h              |    6 +---
 sha1_file.c             |   60 ++++++++++++++++++++--------------------------
 10 files changed, 51 insertions(+), 72 deletions(-)
Next: Junio C Hamano
Message 1 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.