summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-02-03 15:04:48 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-02-03 15:04:48 -0800
commit15bf48b9872e9c42015aa6bffcbafa4c680013ff (patch)
tree489f9fdb104aebf676a3fc1a791c25f438c5a3c3
parentMerge branch 'ab/fsck-doc-fix' (diff)
parentt7900: clean up some broken refs (diff)
downloadtgif-15bf48b9872e9c42015aa6bffcbafa4c680013ff.tar.xz
Merge branch 'ds/maintenance-prefetch-cleanup'
Test clean-up plus UI improvement by hiding extra refs that the prefetch task uses from "log --decorate" output. * ds/maintenance-prefetch-cleanup: t7900: clean up some broken refs maintenance: set log.excludeDecoration durin prefetch
-rw-r--r--builtin/gc.c6
-rwxr-xr-xt/t7900-maintenance.sh33
2 files changed, 38 insertions, 1 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index ae34362e93..ef7a155479 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -897,6 +897,12 @@ static int maintenance_task_prefetch(struct maintenance_run_opts *opts)
struct string_list_item *item;
struct string_list remotes = STRING_LIST_INIT_DUP;
+ git_config_set_multivar_gently("log.excludedecoration",
+ "refs/prefetch/",
+ "refs/prefetch/",
+ CONFIG_FLAGS_FIXED_VALUE |
+ CONFIG_FLAGS_MULTI_REPLACE);
+
if (for_each_remote(append_remote, &remotes)) {
error(_("failed to fill remotes"));
result = 1;
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 1074009cc0..78ccf4b33f 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -149,7 +149,31 @@ test_expect_success 'prefetch multiple remotes' '
git log prefetch/remote2/two &&
git fetch --all &&
test_cmp_rev refs/remotes/remote1/one refs/prefetch/remote1/one &&
- test_cmp_rev refs/remotes/remote2/two refs/prefetch/remote2/two
+ test_cmp_rev refs/remotes/remote2/two refs/prefetch/remote2/two &&
+
+ test_cmp_config refs/prefetch/ log.excludedecoration &&
+ git log --oneline --decorate --all >log &&
+ ! grep "prefetch" log
+'
+
+test_expect_success 'prefetch and existing log.excludeDecoration values' '
+ git config --unset-all log.excludeDecoration &&
+ git config log.excludeDecoration refs/remotes/remote1/ &&
+ git maintenance run --task=prefetch &&
+
+ git config --get-all log.excludeDecoration >out &&
+ grep refs/remotes/remote1/ out &&
+ grep refs/prefetch/ out &&
+
+ git log --oneline --decorate --all >log &&
+ ! grep "prefetch" log &&
+ ! grep "remote1" log &&
+ grep "remote2" log &&
+
+ # a second run does not change the config
+ git maintenance run --task=prefetch &&
+ git log --oneline --decorate --all >log2 &&
+ test_cmp log log2
'
test_expect_success 'loose-objects task' '
@@ -232,6 +256,13 @@ test_expect_success 'incremental-repack task' '
HEAD
^HEAD~1
EOF
+
+ # Delete refs that have not been repacked in these packs.
+ git for-each-ref --format="delete %(refname)" \
+ refs/prefetch refs/tags >refs &&
+ git update-ref --stdin <refs &&
+
+ # Replace the object directory with this pack layout.
rm -f $packDir/pack-* &&
rm -f $packDir/loose-* &&
ls $packDir/*.pack >packs-before &&