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
This commit is contained in:
Junio C Hamano 2021-02-03 15:04:48 -08:00
commit 15bf48b987
2 changed files with 38 additions and 1 deletions

View file

@ -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;

View file

@ -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 &&