Skip to content

"git repack -a -d" improvements

Junio C Hamano git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6git-repack: resist stray environment variablegit-repack.sh+1 -00 replies
2/6has_sha1_pack(): refactor "pretend these packs do not exist" interfacebuiltin-count-objects.c builtin-fsck.c builtin-prune-packed.c +4 more+33 -130 replies
3/6has_sha1_kept_pack(): take "struct rev_info"cache.h revision.c revision.h +1 more+12 -90 replies
4/6Consolidate ignore_packed logic morebuiltin-pack-objects.c cache.h revision.h +1 more+17 -210 replies
5/6Simplify is_kept_pack()builtin-pack-objects.c git-repack.sh revision.c +2 more+18 -510 replies
6/6is_kept_pack(): final clean-upbuiltin-pack-objects.c cache.h revision.c +2 more+13 -210 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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(-)