From 230356ba704fc36e848e94b13c5b92acfa4c6fc6 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:16 +0000 Subject: [PATCH 01/22] t4202: split testcase for invalid HEAD symref and HEAD hash Reftable will prohibit invalid hashes at the storage level, but git-symbolic-ref can still create branches ending in ".lock". Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 350cfa3593..327991fcea 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -1834,14 +1834,18 @@ test_expect_success 'log --graph --no-walk is forbidden' ' test_must_fail git log --graph --no-walk ' -test_expect_success 'log diagnoses bogus HEAD' ' +test_expect_success 'log diagnoses bogus HEAD hash' ' git init empty && + test_when_finished "rm -rf empty" && test_must_fail git -C empty log 2>stderr && test_i18ngrep does.not.have.any.commits stderr && echo 1234abcd >empty/.git/refs/heads/main && test_must_fail git -C empty log 2>stderr && - test_i18ngrep broken stderr && - echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD && + test_i18ngrep broken stderr' + +test_expect_success 'log diagnoses bogus HEAD symref' ' + git init empty && + git --git-dir empty/.git symbolic-ref HEAD refs/heads/invalid.lock && test_must_fail git -C empty log 2>stderr && test_i18ngrep broken stderr && test_must_fail git -C empty log --default totally-bogus 2>stderr && From 0221eb86782bdd2cbbe9d6223d7ac9bcb61961b1 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:17 +0000 Subject: [PATCH 02/22] t/helper/ref-store: initialize oid in resolve-ref MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will print $ZERO_OID when asking for a non-existent ref from the test-helper. Since resolve-ref provides direct access to refs_resolve_ref_unsafe(), it provides a reliable mechanism for accessing REFNAME, while avoiding the implicit resolution to refs/heads/REFNAME. Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- t/helper/test-ref-store.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index bba5f841c6..b314b81a45 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -118,7 +118,7 @@ static int cmd_for_each_ref(struct ref_store *refs, const char **argv) static int cmd_resolve_ref(struct ref_store *refs, const char **argv) { - struct object_id oid; + struct object_id oid = *null_oid(); const char *refname = notnull(*argv++, "refname"); int resolve_flags = arg_flags(*argv++, "resolve-flags"); int flags; From 62038c81f35455745066e6f746d5f0b0a1e1f917 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:18 +0000 Subject: [PATCH 03/22] t9300: check ref existence using test-helper rather than a file system check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t9300-fast-import.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 5c47ac4465..1aea943bef 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -392,7 +392,7 @@ test_expect_success 'B: accept branch name "TEMP_TAG"' ' git gc git prune" && git fast-import Date: Mon, 31 May 2021 16:56:19 +0000 Subject: [PATCH 04/22] t5601: read HEAD using rev-parse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t5601-clone.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 329ae599fd..7223372c76 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -305,7 +305,8 @@ test_expect_success 'clone from original with relative alternate' ' test_expect_success 'clone checking out a tag' ' git clone --branch=some-tag src dst.tag && GIT_DIR=src/.git git rev-parse some-tag >expected && - test_cmp expected dst.tag/.git/HEAD && + GIT_DIR=dst.tag/.git git rev-parse HEAD >actual && + test_cmp expected actual && GIT_DIR=dst.tag/.git git config remote.origin.fetch >fetch.actual && echo "+refs/heads/*:refs/remotes/origin/*" >fetch.expected && test_cmp fetch.expected fetch.actual From 9910cbb6f988341001ded0c879fb54865a19d592 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:20 +0000 Subject: [PATCH 05/22] t1401: use tar to snapshot and restore repo state This is agnostic to the ref storage format Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- t/t1401-symbolic-ref.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh index a4ebb0b65f..7a9629fb9f 100755 --- a/t/t1401-symbolic-ref.sh +++ b/t/t1401-symbolic-ref.sh @@ -7,9 +7,16 @@ test_description='basic symbolic-ref tests' # the git repo, meaning that further tests will operate on # the surrounding git repo instead of the trash directory. reset_to_sane() { - echo ref: refs/heads/foo >.git/HEAD + rm -rf .git && + "$TAR" xf .git.tar } +test_expect_success 'setup' ' + git symbolic-ref HEAD refs/heads/foo && + test_commit file && + "$TAR" cf .git.tar .git/ +' + test_expect_success 'symbolic-ref writes HEAD' ' git symbolic-ref HEAD refs/heads/foo && echo ref: refs/heads/foo >expect && From b1259ecff9a51de22ac8a70fc26c20dde8a18f80 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:21 +0000 Subject: [PATCH 06/22] t1401-symbolic-ref: avoid direct filesystem access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use symbolic-ref and rev-parse to inspect refs. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t1401-symbolic-ref.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh index 7a9629fb9f..132a1b885a 100755 --- a/t/t1401-symbolic-ref.sh +++ b/t/t1401-symbolic-ref.sh @@ -17,14 +17,9 @@ test_expect_success 'setup' ' "$TAR" cf .git.tar .git/ ' -test_expect_success 'symbolic-ref writes HEAD' ' - git symbolic-ref HEAD refs/heads/foo && - echo ref: refs/heads/foo >expect && - test_cmp expect .git/HEAD -' - -test_expect_success 'symbolic-ref reads HEAD' ' - echo refs/heads/foo >expect && +test_expect_success 'symbolic-ref read/write roundtrip' ' + git symbolic-ref HEAD refs/heads/read-write-roundtrip && + echo refs/heads/read-write-roundtrip >expect && git symbolic-ref HEAD >actual && test_cmp expect actual ' @@ -32,12 +27,13 @@ test_expect_success 'symbolic-ref reads HEAD' ' test_expect_success 'symbolic-ref refuses non-ref for HEAD' ' test_must_fail git symbolic-ref HEAD foo ' + reset_to_sane test_expect_success 'symbolic-ref refuses bare sha1' ' - echo content >file && git add file && git commit -m one && test_must_fail git symbolic-ref HEAD $(git rev-parse HEAD) ' + reset_to_sane test_expect_success 'HEAD cannot be removed' ' @@ -49,16 +45,16 @@ reset_to_sane test_expect_success 'symbolic-ref can be deleted' ' git symbolic-ref NOTHEAD refs/heads/foo && git symbolic-ref -d NOTHEAD && - test_path_is_file .git/refs/heads/foo && - test_path_is_missing .git/NOTHEAD + git rev-parse refs/heads/foo && + test_must_fail git symbolic-ref NOTHEAD ' reset_to_sane test_expect_success 'symbolic-ref can delete dangling symref' ' git symbolic-ref NOTHEAD refs/heads/missing && git symbolic-ref -d NOTHEAD && - test_path_is_missing .git/refs/heads/missing && - test_path_is_missing .git/NOTHEAD + test_must_fail git rev-parse refs/heads/missing && + test_must_fail git symbolic-ref NOTHEAD ' reset_to_sane From 1142746cbbf016fe2568076d6f30b2b73b29e731 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:22 +0000 Subject: [PATCH 07/22] t1413: use tar to save and restore entire .git directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the test independent of the particulars of the storage formats. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t1413-reflog-detach.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/t/t1413-reflog-detach.sh b/t/t1413-reflog-detach.sh index bde05208ae..934688a1ee 100755 --- a/t/t1413-reflog-detach.sh +++ b/t/t1413-reflog-detach.sh @@ -7,8 +7,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh reset_state () { - git checkout main && - cp saved_reflog .git/logs/HEAD + rm -rf .git && "$TAR" xf .git-saved.tar } test_expect_success setup ' @@ -17,7 +16,7 @@ test_expect_success setup ' git branch side && test_tick && git commit --allow-empty -m second && - cat .git/logs/HEAD >saved_reflog + "$TAR" cf .git-saved.tar .git ' test_expect_success baseline ' From 0218ad5d5c41d7b4adc2ff817391d9e488d328d3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:23 +0000 Subject: [PATCH 08/22] t1301: fix typo in error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t1301-shared-repo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh index ac947bff9f..84bf1970d8 100755 --- a/t/t1301-shared-repo.sh +++ b/t/t1301-shared-repo.sh @@ -124,7 +124,7 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' ' : happy ;; *) - echo Ooops, .git/logs/refs/heads/main is not 0662 [$actual] + echo Ooops, .git/logs/refs/heads/main is not 066x [$actual] false ;; esac From 9c8e7e968c0a22774754f8c8577872dfbb308456 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:24 +0000 Subject: [PATCH 09/22] t5000: reformat indentation to the latest fashion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 113 ++++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 51 deletions(-) diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 7204799a0b..8c5867b6c8 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -111,25 +111,34 @@ test_expect_success 'setup' ' EOF ' -test_expect_success \ - 'populate workdir' \ - 'mkdir a && - echo simple textfile >a/a && - ten=0123456789 && hundred=$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten && - echo long filename >a/four$hundred && - mkdir a/bin && - test-tool genrandom "frotz" 500000 >a/bin/sh && - printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 && - printf "A not substituted O" >a/substfile2 && - if test_have_prereq SYMLINKS; then - ln -s a a/l1 - else - printf %s a > a/l1 - fi && - (p=long_path_to_a_file && cd a && - for depth in 1 2 3 4 5; do mkdir $p && cd $p; done && - echo text >file_with_long_path) && - (cd a && find .) | sort >a.lst' +test_expect_success 'populate workdir' ' + mkdir a && + echo simple textfile >a/a && + ten=0123456789 && + hundred="$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten" && + echo long filename >"a/four$hundred" && + mkdir a/bin && + test-tool genrandom "frotz" 500000 >a/bin/sh && + printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 && + printf "A not substituted O" >a/substfile2 && + if test_have_prereq SYMLINKS + then + ln -s a a/l1 + else + printf %s a >a/l1 + fi && + ( + p=long_path_to_a_file && + cd a && + for depth in 1 2 3 4 5 + do + mkdir $p && + cd $p + done && + echo text >file_with_long_path + ) && + (cd a && find .) | sort >a.lst +' test_expect_success \ 'add ignored file' \ @@ -147,18 +156,18 @@ test_expect_success 'setup export-subst' ' >a/substfile1 ' -test_expect_success \ - 'create bare clone' \ - 'git clone --bare . bare.git && - cp .git/info/attributes bare.git/info/attributes' +test_expect_success 'create bare clone' ' + git clone --bare . bare.git && + cp .git/info/attributes bare.git/info/attributes +' -test_expect_success \ - 'remove ignored file' \ - 'rm a/ignored' +test_expect_success 'remove ignored file' ' + rm a/ignored +' -test_expect_success \ - 'git archive' \ - 'git archive HEAD >b.tar' +test_expect_success 'git archive' ' + git archive HEAD >b.tar +' check_tar b @@ -194,26 +203,28 @@ check_added with_untracked2 untracked one/untracked check_added with_untracked2 untracked two/untracked test_expect_success 'git archive on large files' ' - test_config core.bigfilethreshold 1 && - git archive HEAD >b3.tar && - test_cmp_bin b.tar b3.tar + test_config core.bigfilethreshold 1 && + git archive HEAD >b3.tar && + test_cmp_bin b.tar b3.tar ' -test_expect_success \ - 'git archive in a bare repo' \ - '(cd bare.git && git archive HEAD) >b3.tar' +test_expect_success 'git archive in a bare repo' ' + git --git-dir bare.git archive HEAD >b3.tar +' -test_expect_success \ - 'git archive vs. the same in a bare repo' \ - 'test_cmp_bin b.tar b3.tar' +test_expect_success 'git archive vs. the same in a bare repo' ' + test_cmp_bin b.tar b3.tar +' -test_expect_success 'git archive with --output' \ - 'git archive --output=b4.tar HEAD && - test_cmp_bin b.tar b4.tar' +test_expect_success 'git archive with --output' ' + git archive --output=b4.tar HEAD && + test_cmp_bin b.tar b4.tar +' -test_expect_success 'git archive --remote' \ - 'git archive --remote=. HEAD >b5.tar && - test_cmp_bin b.tar b5.tar' +test_expect_success 'git archive --remote' ' + git archive --remote=. HEAD >b5.tar && + test_cmp_bin b.tar b5.tar +' test_expect_success 'git archive --remote with configured remote' ' git config remote.foo.url . && @@ -224,13 +235,13 @@ test_expect_success 'git archive --remote with configured remote' ' test_cmp_bin b.tar b5-nick.tar ' -test_expect_success \ - 'validate file modification time' \ - 'mkdir extract && - "$TAR" xf b.tar -C extract a/a && - test-tool chmtime --get extract/a/a >b.mtime && - echo "1117231200" >expected.mtime && - test_cmp expected.mtime b.mtime' +test_expect_success 'validate file modification time' ' + mkdir extract && + "$TAR" xf b.tar -C extract a/a && + test-tool chmtime --get extract/a/a >b.mtime && + echo "1117231200" >expected.mtime && + test_cmp expected.mtime b.mtime +' test_expect_success \ 'git get-tar-commit-id' \ From f1ed224753728b6defc6bc6e9058717a0645482d Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:25 +0000 Subject: [PATCH 10/22] t5000: inspect HEAD using git-rev-parse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 8c5867b6c8..2c88d1c159 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -243,10 +243,11 @@ test_expect_success 'validate file modification time' ' test_cmp expected.mtime b.mtime ' -test_expect_success \ - 'git get-tar-commit-id' \ - 'git get-tar-commit-id b.commitid && - test_cmp .git/$(git symbolic-ref HEAD) b.commitid' +test_expect_success 'git get-tar-commit-id' ' + git get-tar-commit-id actual && + git rev-parse HEAD >expect && + test_cmp expect actual +' test_expect_success 'git archive with --output, override inferred format' ' git archive --format=tar --output=d4.zip HEAD && From fdc8acc7066650b967d8957bc24d58eb54b537f8 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:26 +0000 Subject: [PATCH 11/22] t7003: use rev-parse rather than FS inspection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 1349e5b232..cf30055c88 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -395,7 +395,7 @@ test_expect_success '--prune-empty is able to prune root commit' ' test_expect_success '--prune-empty is able to prune entire branch' ' git branch prune-entire B && git filter-branch -f --prune-empty --index-filter "git update-index --remove A.t B.t" prune-entire && - test_path_is_missing .git/refs/heads/prune-entire && + test_must_fail git rev-parse refs/heads/prune-entire && test_must_fail git reflog exists refs/heads/prune-entire ' From 1fa9cf6ea14eba36d72eb48e82069012c6c8af90 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:27 +0000 Subject: [PATCH 12/22] t5304: restyle: trim empty lines, drop ':' before > MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t5304-prune.sh | 74 +++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 54 deletions(-) diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index b447ce56a9..7f47f13c78 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -22,30 +22,25 @@ add_blob() { } test_expect_success setup ' - - : > file && + >file && git add file && test_tick && git commit -m initial && git gc - ' test_expect_success 'prune stale packs' ' - orig_pack=$(echo .git/objects/pack/*.pack) && - : > .git/objects/tmp_1.pack && - : > .git/objects/tmp_2.pack && + >.git/objects/tmp_1.pack && + >.git/objects/tmp_2.pack && test-tool chmtime =-86501 .git/objects/tmp_1.pack && git prune --expire 1.day && test_path_is_file $orig_pack && test_path_is_file .git/objects/tmp_2.pack && test_path_is_missing .git/objects/tmp_1.pack - ' test_expect_success 'prune --expire' ' - add_blob && git prune --expire=1.hour.ago && verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") && @@ -54,11 +49,9 @@ test_expect_success 'prune --expire' ' git prune --expire 1.day && verbose test $before = $(git count-objects | sed "s/ .*//") && test_path_is_missing $BLOB_FILE - ' test_expect_success 'gc: implicit prune --expire' ' - add_blob && test-tool chmtime =-$((2*$week-30)) $BLOB_FILE && git gc && @@ -68,33 +61,25 @@ test_expect_success 'gc: implicit prune --expire' ' git gc && verbose test $before = $(git count-objects | sed "s/ .*//") && test_path_is_missing $BLOB_FILE - ' test_expect_success 'gc: refuse to start with invalid gc.pruneExpire' ' - git config gc.pruneExpire invalid && test_must_fail git gc - ' test_expect_success 'gc: start with ok gc.pruneExpire' ' - git config gc.pruneExpire 2.days.ago && git gc - ' test_expect_success 'prune: prune nonsense parameters' ' - test_must_fail git prune garbage && test_must_fail git prune --- && test_must_fail git prune --no-such-option - ' test_expect_success 'prune: prune unreachable heads' ' - git config core.logAllRefUpdates false && mv .git/logs .git/logs.old && : > file2 && @@ -104,11 +89,9 @@ test_expect_success 'prune: prune unreachable heads' ' git reset HEAD^ && git prune && test_must_fail git reset $tmp_head -- - ' test_expect_success 'prune: do not prune detached HEAD with no reflog' ' - git checkout --detach --quiet && git commit --allow-empty -m "detached commit" && # verify that there is no reflogs @@ -116,75 +99,61 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' ' test_path_is_missing .git/logs && git prune -n >prune_actual && test_must_be_empty prune_actual - ' test_expect_success 'prune: prune former HEAD after checking out branch' ' - head_oid=$(git rev-parse HEAD) && git checkout --quiet main && git prune -v >prune_actual && grep "$head_oid" prune_actual - ' test_expect_success 'prune: do not prune heads listed as an argument' ' - - : > file2 && + >file2 && git add file2 && git commit -m temporary && tmp_head=$(git rev-list -1 HEAD) && git reset HEAD^ && git prune -- $tmp_head && git reset $tmp_head -- - ' test_expect_success 'gc --no-prune' ' - add_blob && test-tool chmtime =-$((5001*$day)) $BLOB_FILE && git config gc.pruneExpire 2.days.ago && git gc --no-prune && verbose test 1 = $(git count-objects | sed "s/ .*//") && test_path_is_file $BLOB_FILE - ' test_expect_success 'gc respects gc.pruneExpire' ' - git config gc.pruneExpire 5002.days.ago && git gc && test_path_is_file $BLOB_FILE && git config gc.pruneExpire 5000.days.ago && git gc && test_path_is_missing $BLOB_FILE - ' test_expect_success 'gc --prune=' ' - add_blob && test-tool chmtime =-$((5001*$day)) $BLOB_FILE && git gc --prune=5002.days.ago && test_path_is_file $BLOB_FILE && git gc --prune=5000.days.ago && test_path_is_missing $BLOB_FILE - ' test_expect_success 'gc --prune=never' ' - add_blob && git gc --prune=never && test_path_is_file $BLOB_FILE && git gc --prune=now && test_path_is_missing $BLOB_FILE - ' test_expect_success 'gc respects gc.pruneExpire=never' ' - git config gc.pruneExpire never && add_blob && git gc && @@ -192,17 +161,14 @@ test_expect_success 'gc respects gc.pruneExpire=never' ' git config gc.pruneExpire now && git gc && test_path_is_missing $BLOB_FILE - ' test_expect_success 'prune --expire=never' ' - add_blob && git prune --expire=never && test_path_is_file $BLOB_FILE && git prune && test_path_is_missing $BLOB_FILE - ' test_expect_success 'gc: prune old objects after local clone' ' @@ -222,16 +188,16 @@ test_expect_success 'gc: prune old objects after local clone' ' test_expect_success 'garbage report in count-objects -v' ' test_when_finished "rm -f .git/objects/pack/fake*" && test_when_finished "rm -f .git/objects/pack/foo*" && - : >.git/objects/pack/foo && - : >.git/objects/pack/foo.bar && - : >.git/objects/pack/foo.keep && - : >.git/objects/pack/foo.pack && - : >.git/objects/pack/fake.bar && - : >.git/objects/pack/fake.keep && - : >.git/objects/pack/fake.pack && - : >.git/objects/pack/fake.idx && - : >.git/objects/pack/fake2.keep && - : >.git/objects/pack/fake3.idx && + >.git/objects/pack/foo && + >.git/objects/pack/foo.bar && + >.git/objects/pack/foo.keep && + >.git/objects/pack/foo.pack && + >.git/objects/pack/fake.bar && + >.git/objects/pack/fake.keep && + >.git/objects/pack/fake.pack && + >.git/objects/pack/fake.idx && + >.git/objects/pack/fake2.keep && + >.git/objects/pack/fake3.idx && git count-objects -v 2>stderr && grep "index file .git/objects/pack/fake.idx is too small" stderr && grep "^warning:" stderr | sort >actual && @@ -250,12 +216,12 @@ EOF test_expect_success 'clean pack garbage with gc' ' test_when_finished "rm -f .git/objects/pack/fake*" && test_when_finished "rm -f .git/objects/pack/foo*" && - : >.git/objects/pack/foo.keep && - : >.git/objects/pack/foo.pack && - : >.git/objects/pack/fake.idx && - : >.git/objects/pack/fake2.keep && - : >.git/objects/pack/fake2.idx && - : >.git/objects/pack/fake3.keep && + >.git/objects/pack/foo.keep && + >.git/objects/pack/foo.pack && + >.git/objects/pack/fake.idx && + >.git/objects/pack/fake2.keep && + >.git/objects/pack/fake2.idx && + >.git/objects/pack/fake3.keep && git gc && git count-objects -v 2>stderr && grep "^warning:" stderr | sort >actual && From d491f5ea07e5bb85be75060d3939894892f9478a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:28 +0000 Subject: [PATCH 13/22] t5304: use "reflog expire --all" to clear the reflog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test checks that unreachable objects are really removed. For the test to work, it has to ensure that no reflog retain any reachable objects. Previously, it did this by manipulating the file system to remove reflog in the first test, and relying on git not updating the reflog if the relevant logfile doesn't exist in follow-up tests. Now, explicitly clear the reflog using 'reflog expire'. This reduces the dependency between test functions. It also is more amenable to use with reftable, which has no concept of (non)-existence of a reflog Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t5304-prune.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index 7f47f13c78..7b850ae261 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -81,12 +81,12 @@ test_expect_success 'prune: prune nonsense parameters' ' test_expect_success 'prune: prune unreachable heads' ' git config core.logAllRefUpdates false && - mv .git/logs .git/logs.old && - : > file2 && + >file2 && git add file2 && git commit -m temporary && tmp_head=$(git rev-list -1 HEAD) && git reset HEAD^ && + git reflog expire --all && git prune && test_must_fail git reset $tmp_head -- ' @@ -94,9 +94,7 @@ test_expect_success 'prune: prune unreachable heads' ' test_expect_success 'prune: do not prune detached HEAD with no reflog' ' git checkout --detach --quiet && git commit --allow-empty -m "detached commit" && - # verify that there is no reflogs - # (should be removed and disabled by previous test) - test_path_is_missing .git/logs && + git reflog expire --all && git prune -n >prune_actual && test_must_be_empty prune_actual ' @@ -104,6 +102,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' ' test_expect_success 'prune: prune former HEAD after checking out branch' ' head_oid=$(git rev-parse HEAD) && git checkout --quiet main && + git reflog expire --all && git prune -v >prune_actual && grep "$head_oid" prune_actual ' From c305e667e0cad4acb40a4d408e44b823fa47c111 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:29 +0000 Subject: [PATCH 14/22] test-lib: provide test prereq REFFILES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REFFILES can be used to mark tests that are specific to the packed/loose ref storage format and its limitations. Marking such tests is a preparation for introducing the reftable storage backend. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/README | 6 ++++++ t/test-lib.sh | 2 ++ 2 files changed, 8 insertions(+) diff --git a/t/README b/t/README index fd9375b146..723bd3387f 100644 --- a/t/README +++ b/t/README @@ -1114,6 +1114,12 @@ use these, and "test_set_prereq" for how to define your own. Git wasn't compiled with NO_PTHREADS=YesPlease. + - REFFILES + + Test is specific to packed/loose ref storage, and should be + disabled for other ref storage backends + + Tips for Writing Tests ---------------------- diff --git a/t/test-lib.sh b/t/test-lib.sh index d3f6af6a65..ea7397c633 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1481,6 +1481,8 @@ parisc* | hppa*) ;; esac +test_set_prereq REFFILES + ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1 test -z "$NO_PERL" && test_set_prereq PERL test -z "$NO_PTHREADS" && test_set_prereq PTHREADS From 759d02d1aeb2e9d51afe9f948fe0dc15093722a0 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:30 +0000 Subject: [PATCH 15/22] t1407: require REFFILES for for_each_reflog test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add extensive comment why this test needs a REFFILES annotation. I tried forcing universal reflog creation with core.logAllRefUpdates=true, but that apparently also doesn't cause reflogs to be created for pseudorefs Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t1407-worktree-ref-store.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh index d3fe777511..ad8006c813 100755 --- a/t/t1407-worktree-ref-store.sh +++ b/t/t1407-worktree-ref-store.sh @@ -52,7 +52,14 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' ' test_cmp expected actual ' -test_expect_success 'for_each_reflog()' ' +# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should +# only appear in the for-each-reflog output if it is called from the correct +# worktree, which is exercised in this test. This test is poorly written (and +# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly +# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3) +# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is +# not testing a realistic scenario. +test_expect_success REFFILES 'for_each_reflog()' ' echo $ZERO_OID > .git/logs/PSEUDO-MAIN && mkdir -p .git/logs/refs/bisect && echo $ZERO_OID > .git/logs/refs/bisect/random && From 41e2e177c7b8d3e8861c30342c5e57edd5425997 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:31 +0000 Subject: [PATCH 16/22] t1414: mark corruption test with REFFILES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test checks what happens if reflog and ref database disagree on the state of the latest commit. This seems to require accessing reflog storage directly. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t1414-reflog-walk.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/t1414-reflog-walk.sh b/t/t1414-reflog-walk.sh index 80d94704d0..ea64cecf47 100755 --- a/t/t1414-reflog-walk.sh +++ b/t/t1414-reflog-walk.sh @@ -119,7 +119,9 @@ test_expect_success 'min/max age uses entry date to limit' ' test_cmp expect actual ' -test_expect_success 'walk prefers reflog to ref tip' ' +# Create a situation where the reflog and ref database disagree about the latest +# state of HEAD. +test_expect_success REFFILES 'walk prefers reflog to ref tip' ' head=$(git rev-parse HEAD) && one=$(git rev-parse one) && ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" && From a5709636d9958b78ed6cd708ac1c5f80f4b9dc91 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:32 +0000 Subject: [PATCH 17/22] t2017: mark --orphan/logAllRefUpdates=false test as REFFILES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In reftable, there is no notion of a per-ref 'existence' of a reflog. Each reflog entry has its own key, so it is not possible to distinguish between {reflog doesn't exist,reflog exists but is empty}. This makes the logic in log_ref_setup() (file refs/files-backend.c), which depends on the existence of the reflog file infeasible. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t2017-checkout-orphan.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh index c7adbdd39a..88d6992a5e 100755 --- a/t/t2017-checkout-orphan.sh +++ b/t/t2017-checkout-orphan.sh @@ -76,7 +76,7 @@ test_expect_success '--orphan makes reflog by default' ' git rev-parse --verify delta@{0} ' -test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' ' +test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' ' git checkout main && git config core.logAllRefUpdates false && git checkout --orphan epsilon && From fe8fc09f34c353b744d793d45c2ee62fb1a5f699 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:33 +0000 Subject: [PATCH 18/22] t1404: mark tests that muck with .git directly as REFFILES. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The packed/loose ref storage is an overlay combination of packed-refs (refs and tags in a single file) and one-file-per-ref. This creates all kinds of edge cases related to directory/file conflicts, (non-)empty directories, and the locking scheme, none of which applies to reftable. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t1404-update-ref-errors.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh index 8b51c4efc1..b729c1f480 100755 --- a/t/t1404-update-ref-errors.sh +++ b/t/t1404-update-ref-errors.sh @@ -189,7 +189,7 @@ test_expect_success 'one new ref is a simple prefix of another' ' ' -test_expect_success 'empty directory should not fool rev-parse' ' +test_expect_success REFFILES 'empty directory should not fool rev-parse' ' prefix=refs/e-rev-parse && git update-ref $prefix/foo $C && git pack-refs --all && @@ -199,7 +199,7 @@ test_expect_success 'empty directory should not fool rev-parse' ' test_cmp expected actual ' -test_expect_success 'empty directory should not fool for-each-ref' ' +test_expect_success REFFILES 'empty directory should not fool for-each-ref' ' prefix=refs/e-for-each-ref && git update-ref $prefix/foo $C && git for-each-ref $prefix >expected && @@ -209,14 +209,14 @@ test_expect_success 'empty directory should not fool for-each-ref' ' test_cmp expected actual ' -test_expect_success 'empty directory should not fool create' ' +test_expect_success REFFILES 'empty directory should not fool create' ' prefix=refs/e-create && mkdir -p .git/$prefix/foo/bar/baz && printf "create %s $C\n" $prefix/foo | git update-ref --stdin ' -test_expect_success 'empty directory should not fool verify' ' +test_expect_success REFFILES 'empty directory should not fool verify' ' prefix=refs/e-verify && git update-ref $prefix/foo $C && git pack-refs --all && @@ -225,7 +225,7 @@ test_expect_success 'empty directory should not fool verify' ' git update-ref --stdin ' -test_expect_success 'empty directory should not fool 1-arg update' ' +test_expect_success REFFILES 'empty directory should not fool 1-arg update' ' prefix=refs/e-update-1 && git update-ref $prefix/foo $C && git pack-refs --all && @@ -234,7 +234,7 @@ test_expect_success 'empty directory should not fool 1-arg update' ' git update-ref --stdin ' -test_expect_success 'empty directory should not fool 2-arg update' ' +test_expect_success REFFILES 'empty directory should not fool 2-arg update' ' prefix=refs/e-update-2 && git update-ref $prefix/foo $C && git pack-refs --all && @@ -243,7 +243,7 @@ test_expect_success 'empty directory should not fool 2-arg update' ' git update-ref --stdin ' -test_expect_success 'empty directory should not fool 0-arg delete' ' +test_expect_success REFFILES 'empty directory should not fool 0-arg delete' ' prefix=refs/e-delete-0 && git update-ref $prefix/foo $C && git pack-refs --all && @@ -252,7 +252,7 @@ test_expect_success 'empty directory should not fool 0-arg delete' ' git update-ref --stdin ' -test_expect_success 'empty directory should not fool 1-arg delete' ' +test_expect_success REFFILES 'empty directory should not fool 1-arg delete' ' prefix=refs/e-delete-1 && git update-ref $prefix/foo $C && git pack-refs --all && @@ -466,7 +466,7 @@ test_expect_success 'incorrect old value blocks indirect no-deref delete' ' test_cmp expected output.err ' -test_expect_success 'non-empty directory blocks create' ' +test_expect_success REFFILES 'non-empty directory blocks create' ' prefix=refs/ne-create && mkdir -p .git/$prefix/foo/bar && : >.git/$prefix/foo/bar/baz.lock && @@ -485,7 +485,7 @@ test_expect_success 'non-empty directory blocks create' ' test_cmp expected output.err ' -test_expect_success 'broken reference blocks create' ' +test_expect_success REFFILES 'broken reference blocks create' ' prefix=refs/broken-create && mkdir -p .git/$prefix && echo "gobbledigook" >.git/$prefix/foo && @@ -504,7 +504,7 @@ test_expect_success 'broken reference blocks create' ' test_cmp expected output.err ' -test_expect_success 'non-empty directory blocks indirect create' ' +test_expect_success REFFILES 'non-empty directory blocks indirect create' ' prefix=refs/ne-indirect-create && git symbolic-ref $prefix/symref $prefix/foo && mkdir -p .git/$prefix/foo/bar && @@ -524,7 +524,7 @@ test_expect_success 'non-empty directory blocks indirect create' ' test_cmp expected output.err ' -test_expect_success 'broken reference blocks indirect create' ' +test_expect_success REFFILES 'broken reference blocks indirect create' ' prefix=refs/broken-indirect-create && git symbolic-ref $prefix/symref $prefix/foo && echo "gobbledigook" >.git/$prefix/foo && @@ -543,7 +543,7 @@ test_expect_success 'broken reference blocks indirect create' ' test_cmp expected output.err ' -test_expect_success 'no bogus intermediate values during delete' ' +test_expect_success REFFILES 'no bogus intermediate values during delete' ' prefix=refs/slow-transaction && # Set up a reference with differing loose and packed versions: git update-ref $prefix/foo $C && @@ -600,7 +600,7 @@ test_expect_success 'no bogus intermediate values during delete' ' test_must_fail git rev-parse --verify --quiet $prefix/foo ' -test_expect_success 'delete fails cleanly if packed-refs file is locked' ' +test_expect_success REFFILES 'delete fails cleanly if packed-refs file is locked' ' prefix=refs/locked-packed-refs && # Set up a reference with differing loose and packed versions: git update-ref $prefix/foo $C && @@ -616,7 +616,7 @@ test_expect_success 'delete fails cleanly if packed-refs file is locked' ' test_cmp unchanged actual ' -test_expect_success 'delete fails cleanly if packed-refs.new write fails' ' +test_expect_success REFFILES 'delete fails cleanly if packed-refs.new write fails' ' # Setup and expectations are similar to the test above. prefix=refs/failed-packed-refs && git update-ref $prefix/foo $C && From e740873c4778434737e36eecf2a9393abe709a88 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:34 +0000 Subject: [PATCH 19/22] t7900: stop checking for loose refs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Given that git-maintenance simply calls out git-pack-refs, it seems superfluous to test the functionality of pack-refs itself, as that is covered by t3210-pack-refs.sh. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t7900-maintenance.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 2412d8c5c0..70563cc269 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -350,8 +350,6 @@ test_expect_success 'pack-refs task' ' done && GIT_TRACE2_EVENT="$(pwd)/pack-refs.txt" \ git maintenance run --task=pack-refs && - ls .git/refs/heads/ >after && - test_must_be_empty after && test_subcommand git pack-refs --all --prune Date: Mon, 31 May 2021 16:56:35 +0000 Subject: [PATCH 20/22] t7003: check reflog existence only for REFFILES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index cf30055c88..e18a218952 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -396,7 +396,10 @@ test_expect_success '--prune-empty is able to prune entire branch' ' git branch prune-entire B && git filter-branch -f --prune-empty --index-filter "git update-index --remove A.t B.t" prune-entire && test_must_fail git rev-parse refs/heads/prune-entire && - test_must_fail git reflog exists refs/heads/prune-entire + if test_have_prereq REFFILES + then + test_must_fail git reflog exists refs/heads/prune-entire + fi ' test_expect_success '--remap-to-ancestor with filename filters' ' From dc474899e7ad19be0a9f76b2ee2915b8bf79b683 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:36 +0000 Subject: [PATCH 21/22] t4202: mark bogus head hash test with REFFILES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In reftable, hashes are correctly formed by design. Split off test for git-log in empty repo. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 327991fcea..39e746fbcb 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -1834,14 +1834,20 @@ test_expect_success 'log --graph --no-walk is forbidden' ' test_must_fail git log --graph --no-walk ' -test_expect_success 'log diagnoses bogus HEAD hash' ' +test_expect_success 'log on empty repo fails' ' git init empty && test_when_finished "rm -rf empty" && test_must_fail git -C empty log 2>stderr && - test_i18ngrep does.not.have.any.commits stderr && + test_i18ngrep does.not.have.any.commits stderr +' + +test_expect_success REFFILES 'log diagnoses bogus HEAD hash' ' + git init empty && + test_when_finished "rm -rf empty" && echo 1234abcd >empty/.git/refs/heads/main && test_must_fail git -C empty log 2>stderr && - test_i18ngrep broken stderr' + test_i18ngrep broken stderr +' test_expect_success 'log diagnoses bogus HEAD symref' ' git init empty && From 1231cab341e3e14065e39a5403ad8026c9bc19a8 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:37 +0000 Subject: [PATCH 22/22] t1415: set REFFILES for test specific to storage format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Packing refs (and therefore checking that certain refs are not packed) is a property of the packed/loose ref storage. Add a comment to explain what the test checks. Signed-off-by: Han-Wen Nienhuys Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t1415-worktree-refs.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh index 7ab91241ab..66f27d0fdf 100755 --- a/t/t1415-worktree-refs.sh +++ b/t/t1415-worktree-refs.sh @@ -16,7 +16,10 @@ test_expect_success 'setup' ' git -C wt2 update-ref refs/worktree/foo HEAD ' -test_expect_success 'refs/worktree must not be packed' ' +# The 'packed-refs' file is stored directly in .git/. This means it is global +# to the repository, and can only contain refs that are shared across all +# worktrees. +test_expect_success REFFILES 'refs/worktree must not be packed' ' git pack-refs --all && test_path_is_missing .git/refs/tags/wt1 && test_path_is_file .git/refs/worktree/foo &&