nd/repack-keep-pack updates
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest7 patches 0 repliesNew
- v37 patches 7 repliesSuperseded
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | t7700: have closing quote of a test at the beginning of linet/ | +1 | 0 replies | |
| 2/7 | repack: add --keep-pack optionDocumentation/ Documentation/ builtin/ +3 more | +111 | 0 replies | |
| 3/7 | gc: add --keep-largest-pack optionDocumentation/ builtin/ t/ | +73 | 0 replies | |
| 4/7 | gc: add gc.bigPackThreshold configDocumentation/ Documentation/ builtin/ | +32 | 0 replies | |
| 5/7 | gc: handle a corner case in gc.bigPackThresholdDocumentation/ builtin/ | +12 | 0 replies | |
| 6/7 | gc --auto: exclude base pack if not enough mem to "repack -ad"Documentation/ builtin/ builtin/ +4 more | +119 | 0 replies | |
| 7/7 | pack-objects: show some progress when counting kept objectsbuiltin/ | +12 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH v4 0/7] nd/repack-keep-pack updates
v4 is mostly refining tests and other minor fixes on v3
- --keep-base-pack is renamed to --keep-largest-pack
- "Counting objects" progress line is back
- test and docs updates
Interdiff
Documentation/config.txt +2 -1
@@ -1562,7 +1562,8 @@ gc.bigPackThreshold:: If non-zero, all packs larger than this limit are kept when `git gc` is run. This is very similar to `--keep-base-pack` except that all packs that meet the threshold are kept, not - just the base pack. Defaults to zero. + just the base pack. Defaults to zero. Common unit suffixes of + 'k', 'm', or 'g' are supported. + Note that if the number of kept packs is more than gc.autoPackLimit, this configuration variable is ignored, all packs except the base pack
Documentation/git-gc.txt +5 -6
@@ -9,7 +9,7 @@ git-gc - Cleanup unnecessary files and optimize the local repository SYNOPSIS -------- [verse] -'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-base-pack] +'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-largest-pack] DESCRIPTION -----------
@@ -84,11 +84,10 @@ packs. Force `git gc` to run even if there may be another `git gc` instance running on this repository. ---keep-base-pack:: - All packs except the base pack and those marked with a `.keep` - files are consolidated into a single pack. The largest pack is - considered the base pack. When this option is used, - `gc.bigPackThreshold` is ignored. +--keep-largest-pack:: + All packs except the largest pack and those marked with a + `.keep` files are consolidated into a single pack. When this + option is used, `gc.bigPackThreshold` is ignored. Configuration -------------
builtin/gc.c +3 -3
@@ -344,7 +344,7 @@ static int need_to_gc(void)find_base_packs (&keep_pack,0 ); } }else { -struct packed_git * p =find_base_packs (&keep_pack,0 ); +struct packed_git *p =find_base_packs (&keep_pack,0 );uint64_t mem_have, mem_want; mem_have =total_ram ();
@@ -504,8 +504,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)OPT_BOOL (0 ,"aggressive" , &aggressive,N_ ("be more thorough (increased runtime)" )),OPT_BOOL (0 ,"auto" , &auto_gc,N_ ("enable auto-gc mode" )),OPT_BOOL (0 ,"force" , &force,N_ ("force running gc even if there may be another gc running" )), -OPT_BOOL (0 ,"keep-base-pack" , &keep_base_pack, -N_ ("repack all other packs except the base pack" )), +OPT_BOOL (0 ,"keep-largest-pack" , &keep_base_pack, +N_ ("repack all other packs except the largest pack" )), OPT_END() };
builtin/pack-objects.c +13 -11
@@ -54,7 +54,8 @@ static int pack_loose_unreachable;static int local;static int have_non_local_packs;static int incremental; -static int ignore_packed_keep, ignore_packed_keep_in_core; +static int ignore_packed_keep_on_disk; +static int ignore_packed_keep_in_core;static int allow_ofs_delta;static struct pack_idx_option pack_idx_opts;static const char *base_name;
@@ -983,14 +984,15 @@ static int want_found_object(int exclude, struct packed_git *p)* Otherwise, we signal "-1" at the end to tell the caller that we do * not know either way, and it needs to check more packs. */ -if (!ignore_packed_keep && !ignore_packed_keep_in_core && +if (!ignore_packed_keep_on_disk && + !ignore_packed_keep_in_core && (!local || !have_non_local_packs))return 1 ;if (local && !p->pack_local)return 0 ;if (p->pack_local && - ((ignore_packed_keep && p->pack_keep) || + ((ignore_packed_keep_on_disk && p->pack_keep) || (ignore_packed_keep_in_core && p->pack_keep_in_core)))return 0 ;
@@ -1716,7 +1718,7 @@ static void get_object_details(void)struct object_entry **sorted_by_offset;if (progress) - progress_state =start_progress (_ ("Getting object details" ), + progress_state =start_progress (_ ("Counting objects" ), to_pack.nr_objects); sorted_by_offset =xcalloc (to_pack.nr_objects,sizeof (struct object_entry *));
@@ -2818,7 +2820,7 @@ static int pack_options_allow_reuse(void) {return pack_to_stdout && allow_ofs_delta && - !ignore_packed_keep && + !ignore_packed_keep_on_disk && !ignore_packed_keep_in_core && (!local || !have_non_local_packs) && !incremental;
@@ -3059,7 +3061,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) N_("create thin packs")),OPT_BOOL (0 ,"shallow" , &shallow,N_ ("create packs suitable for shallow fetches" )), -OPT_BOOL (0 ,"honor-pack-keep" , &ignore_packed_keep, +OPT_BOOL (0 ,"honor-pack-keep" , &ignore_packed_keep_on_disk,N_ ("ignore packs that have companion .keep file" )),OPT_STRING_LIST (0 ,"keep-pack" , &keep_pack_list,N_ ("name" ), N_("ignore this pack")),
@@ -3192,19 +3194,19 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)prepare_packed_git ();add_extra_kept_packs (&keep_pack_list); -if (ignore_packed_keep) { +if (ignore_packed_keep_on_disk) {struct packed_git *p;for (p = packed_git; p; p = p->next)if (p->pack_local && p->pack_keep)break ;if (!p)/* no keep-able packs found */ - ignore_packed_keep =0 ; + ignore_packed_keep_on_disk =0 ; }if (local) {/* -* unlike ignore_packed_keep above, we do not want to -* unset "local" based on looking at packs, as it -* also covers non-local objects +* unlike ignore_packed_keep_on_disk above, we do not +* want to unset "local" based on looking at packs, as +* it also covers non-local objects */ struct packed_git *p;for (p = packed_git; p; p = p->next) {
t/t6500-gc.sh +25 -22
59 lines not on this page · raw message
t/t7700-repack.sh +15 -15
@@ -4,6 +4,12 @@ test_description='git repack works correctly' . ./test-lib.sh +commit_and_pack() { + test_commit "$@" >/dev/null && + SHA1=$(git pack-objects --all --unpacked --incremental .git/objects/pack/pack </dev/null) && + echo pack-${SHA1}.pack +} + test_expect_success 'objects in packs marked .keep are not repacked' ' echo content1 > file1 && echo content2 > file2 &&
@@ -200,22 +206,16 @@ test_expect_success 'repack --keep-pack' ' test_create_repo keep-pack && ( cd keep-pack && - test_commit one && - git repack -d && - test_commit two && - git repack -d && - test_commit three && - git repack -d && - test_commit four && - git repack -d && - ( cd .git/objects/pack && ls *.pack ) >pack-list && - test_line_count = 4 pack-list && - KEEP1=$(head -n1 pack-list) && - KEEP4=$(tail -n1 pack-list) && - git repack -a -d --keep-pack $KEEP1 --keep-pack $KEEP4 && + P1=$(commit_and_pack 1) && + P2=$(commit_and_pack 2) && + P3=$(commit_and_pack 3) && + P4=$(commit_and_pack 4) && + ls .git/objects/pack/*.pack >old-counts && + test_line_count = 4 old-counts && + git repack -a -d --keep-pack $P1 --keep-pack $P4 && ls .git/objects/pack/*.pack >new-counts && - grep -q $KEEP1 new-counts && - grep -q $KEEP4 new-counts && + grep -q $P1 new-counts && + grep -q $P4 new-counts && test_line_count = 3 new-counts && git fsck )
Nguyễn Thái Ngọc Duy (7):
t7700: have closing quote of a test at the beginning of line
repack: add --keep-pack option
gc: add --keep-largest-pack option
gc: add gc.bigPackThreshold config
gc: handle a corner case in gc.bigPackThreshold
gc --auto: exclude base pack if not enough mem to "repack -ad"
pack-objects: show some progress when counting kept objects
Documentation/config.txt | 12 +++ Documentation/git-gc.txt | 19 +++- Documentation/git-pack-objects.txt | 9 +- Documentation/git-repack.txt | 9 +- builtin/gc.c | 167 +++++++++++++++++++++++++++-- builtin/pack-objects.c | 84 +++++++++++---- builtin/repack.c | 21 +++- cache.h | 1 + config.mak.uname | 1 + git-compat-util.h | 4 + pack-objects.h | 2 + t/t6500-gc.sh | 32 ++++++ t/t7700-repack.sh | 27 ++++- 13 files changed, 352 insertions(+), 36 deletions(-)
Signature · 1 line
2.17.0.rc0.348.gd5a49e0b6f