{"thread":{"id":"60756","subject":"[PATCH 00/12] Group reffiles tests","startedAt":"2024-01-17T19:52:38Z","lastAt":"2024-01-24T21:37:04Z","messageCount":47,"participants":["John Cai via GitGitGadget","Junio C Hamano","Patrick Steinhardt","John Cai","Karthik Nayak"],"isPatch":true,"patchVersion":1,"patchTotal":12},"messages":[{"id":"486922","messageId":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":null,"subject":"[PATCH 00/12] Group reffiles tests","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:23Z","receivedAt":"2024-01-17T19:52:38Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"This series groups REFFILES specific tests together. These tests are\ncurrently grouped together across the test suite based on functionality.\nHowever, since they exercise low-level behavior specific to the refs backend\nbeing used (in these cases, the ref-files backend), group them together\nbased on which refs backend they test. This way, in the near future when the\nreftables backend gets upstreamed we can add tests that exercise the\nreftables backend close by in the t06xx area.\n\nThese patches also remove the REFFILES prerequisite, since all the tests in\nt06xx are reffiles specific. In the near future, once the reftable backend\nis upstreamed, all the tests in t06xx will be forced to run with the\nreffiles backend.\n\nJohn Cai (12):\n  t3210: move to t0602\n  remove REFFILES prerequisite\n  t1414: convert test to use Git commands instead of writing refs\n    manually\n  t1404: move reffiles specific tests to t0600\n  t1405: move reffiles specific tests to t0600\n  t1406: move reffiles specific tests to t0600\n  t1410: move reffiles specific tests to t0600\n  t1415: move reffiles specific tests to t0600\n  t1503: move reffiles specific tests to t0600\n  t3903: move reffiles specific tests to t0600\n  t4202: move reffiles specific tests to t0600\n  t5312: move reffiles specific tests to t0600\n\n t/t0600-reffiles-backend.sh                   | 604 ++++++++++++++++++\n ...ck-refs.sh => t0602-reffiles-pack-refs.sh} |   0\n t/t1404-update-ref-errors.sh                  | 378 -----------\n t/t1405-main-ref-store.sh                     |  10 +-\n t/t1407-worktree-ref-store.sh                 |  37 --\n t/t1410-reflog.sh                             |  42 --\n t/t1414-reflog-walk.sh                        |  11 +-\n t/t1415-worktree-refs.sh                      |  11 -\n t/t1503-rev-parse-verify.sh                   |   5 -\n t/t2017-checkout-orphan.sh                    |   2 +-\n t/t3903-stash.sh                              |  43 --\n t/t4202-log.sh                                |  17 -\n t/t5312-prune-corruption.sh                   |  26 -\n t/test-lib-functions.sh                       |  16 +\n 14 files changed, 628 insertions(+), 574 deletions(-)\n create mode 100755 t/t0600-reffiles-backend.sh\n rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)\n\n\nbase-commit: 186b115d3062e6230ee296d1ddaa0c4b72a464b5\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1647%2Fjohn-cai%2Fjc%2Fgroup-reffiles-tests-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1647/john-cai/jc/group-reffiles-tests-v1\nPull-Request: https://github.com/git/git/pull/1647\n-- \ngitgitgadget\n"},{"id":"486923","messageId":"0e2b6e197ab2fbfc81a42fd601b6aaf41e38929f.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 01/12] t3210: move to t0602","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:24Z","receivedAt":"2024-01-17T19:52:39Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove t3210 to t0602, since these tests are reffiles specific in that\nthey modify loose refs manually. This is part of the effort to\ncategorize these tests together based on the ref backend they test. When\nwe upstream the reftable backend, we can add more tests to t06xx. This\nway, all tests that test specific ref backend behavior will be grouped\ntogether.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0\n 1 file changed, 0 insertions(+), 0 deletions(-)\n rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)\n\ndiff --git a/t/t3210-pack-refs.sh b/t/t0602-reffiles-pack-refs.sh\nsimilarity index 100%\nrename from t/t3210-pack-refs.sh\nrename to t/t0602-reffiles-pack-refs.sh\n-- \ngitgitgadget\n\n"},{"id":"486924","messageId":"624ad202305138c312e9db7d9cc590baf4e576ab.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 02/12] remove REFFILES prerequisite","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:25Z","receivedAt":"2024-01-17T19:52:40Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nThese tests are compatible with the reftable backend and thus do not\nneed the REFFILES prerequisite.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t1405-main-ref-store.sh  | 2 +-\n t/t2017-checkout-orphan.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh\nindex e4627cf1b61..62c1eadb190 100755\n--- a/t/t1405-main-ref-store.sh\n+++ b/t/t1405-main-ref-store.sh\n@@ -112,7 +112,7 @@ test_expect_success 'delete_reflog(HEAD)' '\n \ttest_must_fail git reflog exists HEAD\n '\n \n-test_expect_success REFFILES 'create-reflog(HEAD)' '\n+test_expect_success 'create-reflog(HEAD)' '\n \t$RUN create-reflog HEAD &&\n \tgit reflog exists HEAD\n '\ndiff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh\nindex 947d1587ac8..a5c7358eeab 100755\n--- a/t/t2017-checkout-orphan.sh\n+++ b/t/t2017-checkout-orphan.sh\n@@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' '\n \tgit rev-parse --verify delta@{0}\n '\n \n-test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' '\n+test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '\n \tgit checkout main &&\n \tgit config core.logAllRefUpdates false &&\n \tgit checkout --orphan epsilon &&\n-- \ngitgitgadget\n\n"},{"id":"486925","messageId":"19233aa0d4496b66d67fbee82fb8d9b6b35a03cb.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 03/12] t1414: convert test to use Git commands instead of writing refs manually","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:26Z","receivedAt":"2024-01-17T19:52:40Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nThis test can be re-written to use Git commands rather than writing a\nmanual ref in the reflog. This way this test no longer needs the\nREFFILES prerequisite.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t1414-reflog-walk.sh | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t1414-reflog-walk.sh b/t/t1414-reflog-walk.sh\nindex ea64cecf47b..c7b3817d3bd 100755\n--- a/t/t1414-reflog-walk.sh\n+++ b/t/t1414-reflog-walk.sh\n@@ -121,13 +121,14 @@ test_expect_success 'min/max age uses entry date to limit' '\n \n # Create a situation where the reflog and ref database disagree about the latest\n # state of HEAD.\n-test_expect_success REFFILES 'walk prefers reflog to ref tip' '\n+test_expect_success 'walk prefers reflog to ref tip' '\n+\ttest_commit A &&\n+\ttest_commit B &&\n+\tgit reflog delete HEAD@{0} &&\n \thead=$(git rev-parse HEAD) &&\n-\tone=$(git rev-parse one) &&\n-\tident=\"$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\" &&\n-\techo \"$head $one $ident\tbroken reflog entry\" >>.git/logs/HEAD &&\n+\tA=$(git rev-parse A) &&\n \n-\techo $one >expect &&\n+\techo $A >expect &&\n \tgit log -g --format=%H -1 >actual &&\n \ttest_cmp expect actual\n '\n-- \ngitgitgadget\n\n"},{"id":"486926","messageId":"c2af695f551bd70c5f8574239018857a0ab91b35.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 05/12] t1405: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:28Z","receivedAt":"2024-01-17T19:52:42Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test to t0600 with other reffiles specific tests since it is\nreffiles specific in that it looks into the loose refs directory for an\nassertion.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 8 ++++++++\n t/t1405-main-ref-store.sh   | 8 --------\n 2 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 332c8cbc004..53ac4b9b5b8 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -92,6 +92,14 @@ test_expect_success 'setup' '\n \tE=$(git rev-parse HEAD)\n '\n \n+test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '\n+\tN=`find .git/refs -type f | wc -l` &&\n+\ttest \"$N\" != 0 &&\n+\ttest-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&\n+\tN=`find .git/refs -type f` &&\n+\ttest -z \"$N\"\n+'\n+\n test_expect_success 'empty directory should not fool rev-parse' '\n \tprefix=refs/e-rev-parse &&\n \tgit update-ref $prefix/foo $C &&\ndiff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh\nindex 62c1eadb190..976bd71efb5 100755\n--- a/t/t1405-main-ref-store.sh\n+++ b/t/t1405-main-ref-store.sh\n@@ -15,14 +15,6 @@ test_expect_success 'setup' '\n \ttest_commit one\n '\n \n-test_expect_success REFFILES 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '\n-\tN=`find .git/refs -type f | wc -l` &&\n-\ttest \"$N\" != 0 &&\n-\t$RUN pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&\n-\tN=`find .git/refs -type f` &&\n-\ttest -z \"$N\"\n-'\n-\n test_expect_success 'create_symref(FOO, refs/heads/main)' '\n \t$RUN create-symref FOO refs/heads/main nothing &&\n \techo refs/heads/main >expected &&\n-- \ngitgitgadget\n\n"},{"id":"486927","messageId":"0f6fea6d32d242db772fbee0b4aaec044087f53d.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 04/12] t1404: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:27Z","receivedAt":"2024-01-17T19:52:42Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nThese tests modify loose refs manually and are specific to the reffiles\nbackend. Move these to t0600 to be part of a test suite of reffiles\nspecific tests.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh  | 398 +++++++++++++++++++++++++++++++++++\n t/t1404-update-ref-errors.sh | 378 ---------------------------------\n 2 files changed, 398 insertions(+), 378 deletions(-)\n create mode 100755 t/t0600-reffiles-backend.sh\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nnew file mode 100755\nindex 00000000000..332c8cbc004\n--- /dev/null\n+++ b/t/t0600-reffiles-backend.sh\n@@ -0,0 +1,398 @@\n+#!/bin/sh\n+\n+test_description='Test reffiles backend'\n+\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+TEST_PASSES_SANITIZE_LEAK=true\n+. ./test-lib.sh\n+\n+# Test adding and deleting D/F-conflicting references in a single\n+# transaction.\n+df_test() {\n+\tprefix=\"$1\"\n+\tpack=: symadd=false symdel=false add_del=false addref= delref=\n+\tshift\n+\twhile test $# -gt 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t--pack)\n+\t\t\tpack=\"git pack-refs --all\"\n+\t\t\tshift\n+\t\t\t;;\n+\t\t--sym-add)\n+\t\t\t# Perform the add via a symbolic reference\n+\t\t\tsymadd=true\n+\t\t\tshift\n+\t\t\t;;\n+\t\t--sym-del)\n+\t\t\t# Perform the del via a symbolic reference\n+\t\t\tsymdel=true\n+\t\t\tshift\n+\t\t\t;;\n+\t\t--del-add)\n+\t\t\t# Delete first reference then add second\n+\t\t\tadd_del=false\n+\t\t\tdelref=\"$prefix/r/$2\"\n+\t\t\taddref=\"$prefix/r/$3\"\n+\t\t\tshift 3\n+\t\t\t;;\n+\t\t--add-del)\n+\t\t\t# Add first reference then delete second\n+\t\t\tadd_del=true\n+\t\t\taddref=\"$prefix/r/$2\"\n+\t\t\tdelref=\"$prefix/r/$3\"\n+\t\t\tshift 3\n+\t\t\t;;\n+\t\t*)\n+\t\t\techo 1>&2 \"Extra args to df_test: $*\"\n+\t\t\treturn 1\n+\t\t\t;;\n+\t\tesac\n+\tdone\n+\tgit update-ref \"$delref\" $C &&\n+\tif $symadd\n+\tthen\n+\t\taddname=\"$prefix/s/symadd\" &&\n+\t\tgit symbolic-ref \"$addname\" \"$addref\"\n+\telse\n+\t\taddname=\"$addref\"\n+\tfi &&\n+\tif $symdel\n+\tthen\n+\t\tdelname=\"$prefix/s/symdel\" &&\n+\t\tgit symbolic-ref \"$delname\" \"$delref\"\n+\telse\n+\t\tdelname=\"$delref\"\n+\tfi &&\n+\tcat >expected-err <<-EOF &&\n+\tfatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\n+\tEOF\n+\t$pack &&\n+\tif $add_del\n+\tthen\n+\t\tprintf \"%s\\n\" \"create $addname $D\" \"delete $delname\"\n+\telse\n+\t\tprintf \"%s\\n\" \"delete $delname\" \"create $addname $D\"\n+\tfi >commands &&\n+\ttest_must_fail git update-ref --stdin <commands 2>output.err &&\n+\ttest_cmp expected-err output.err &&\n+\tprintf \"%s\\n\" \"$C $delref\" >expected-refs &&\n+\tgit for-each-ref --format=\"%(objectname) %(refname)\" $prefix/r >actual-refs &&\n+\ttest_cmp expected-refs actual-refs\n+}\n+\n+test_expect_success 'setup' '\n+\tgit commit --allow-empty -m Initial &&\n+\tC=$(git rev-parse HEAD) &&\n+\tgit commit --allow-empty -m Second &&\n+\tD=$(git rev-parse HEAD) &&\n+\tgit commit --allow-empty -m Third &&\n+\tE=$(git rev-parse HEAD)\n+'\n+\n+test_expect_success 'empty directory should not fool rev-parse' '\n+\tprefix=refs/e-rev-parse &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\techo \"$C\" >expected &&\n+\tgit rev-parse $prefix/foo >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'empty directory should not fool for-each-ref' '\n+\tprefix=refs/e-for-each-ref &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit for-each-ref $prefix >expected &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tgit for-each-ref $prefix >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'empty directory should not fool create' '\n+\tprefix=refs/e-create &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"create %s $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool verify' '\n+\tprefix=refs/e-verify &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"verify %s $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 1-arg update' '\n+\tprefix=refs/e-update-1 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"update %s $D\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 2-arg update' '\n+\tprefix=refs/e-update-2 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"update %s $D $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 0-arg delete' '\n+\tprefix=refs/e-delete-0 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"delete %s\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 1-arg delete' '\n+\tprefix=refs/e-delete-1 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"delete %s $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'D/F conflict prevents add long + delete short' '\n+\tdf_test refs/df-al-ds --add-del foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents add short + delete long' '\n+\tdf_test refs/df-as-dl --add-del foo foo/bar\n+'\n+\n+test_expect_success 'D/F conflict prevents delete long + add short' '\n+\tdf_test refs/df-dl-as --del-add foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents delete short + add long' '\n+\tdf_test refs/df-ds-al --del-add foo foo/bar\n+'\n+\n+test_expect_success 'D/F conflict prevents add long + delete short packed' '\n+\tdf_test refs/df-al-dsp --pack --add-del foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents add short + delete long packed' '\n+\tdf_test refs/df-as-dlp --pack --add-del foo foo/bar\n+'\n+\n+test_expect_success 'D/F conflict prevents delete long packed + add short' '\n+\tdf_test refs/df-dlp-as --pack --del-add foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents delete short packed + add long' '\n+\tdf_test refs/df-dsp-al --pack --del-add foo foo/bar\n+'\n+\n+# Try some combinations involving symbolic refs...\n+\n+test_expect_success 'D/F conflict prevents indirect add long + delete short' '\n+\tdf_test refs/df-ial-ds --sym-add --add-del foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' '\n+\tdf_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' '\n+\tdf_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar\n+'\n+\n+test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' '\n+\tdf_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents indirect add long + delete short packed' '\n+\tdf_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' '\n+\tdf_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents add long + indirect delete short packed' '\n+\tdf_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo\n+'\n+\n+test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' '\n+\tdf_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo\n+'\n+\n+test_expect_success 'non-empty directory blocks create' '\n+\tprefix=refs/ne-create &&\n+\tmkdir -p .git/$prefix/foo/bar &&\n+\t: >.git/$prefix/foo/bar/baz.lock &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'broken reference blocks create' '\n+\tprefix=refs/broken-create &&\n+\tmkdir -p .git/$prefix &&\n+\techo \"gobbledigook\" >.git/$prefix/foo &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'non-empty directory blocks indirect create' '\n+\tprefix=refs/ne-indirect-create &&\n+\tgit symbolic-ref $prefix/symref $prefix/foo &&\n+\tmkdir -p .git/$prefix/foo/bar &&\n+\t: >.git/$prefix/foo/bar/baz.lock &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'broken reference blocks indirect create' '\n+\tprefix=refs/broken-indirect-create &&\n+\tgit symbolic-ref $prefix/symref $prefix/foo &&\n+\techo \"gobbledigook\" >.git/$prefix/foo &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'no bogus intermediate values during delete' '\n+\tprefix=refs/slow-transaction &&\n+\t# Set up a reference with differing loose and packed versions:\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tgit update-ref $prefix/foo $D &&\n+\t# Now try to update the reference, but hold the `packed-refs` lock\n+\t# for a while to see what happens while the process is blocked:\n+\t: >.git/packed-refs.lock &&\n+\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n+\t{\n+\t\t# Note: the following command is intentionally run in the\n+\t\t# background. We increase the timeout so that `update-ref`\n+\t\t# attempts to acquire the `packed-refs` lock for much longer\n+\t\t# than it takes for us to do the check then delete it:\n+\t\tgit -c core.packedrefstimeout=30000 update-ref -d $prefix/foo &\n+\t} &&\n+\tpid2=$! &&\n+\t# Give update-ref plenty of time to get to the point where it tries\n+\t# to lock packed-refs:\n+\tsleep 1 &&\n+\t# Make sure that update-ref did not complete despite the lock:\n+\tkill -0 $pid2 &&\n+\t# Verify that the reference still has its old value:\n+\tsha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) &&\n+\tcase \"$sha1\" in\n+\t$D)\n+\t\t# This is what we hope for; it means that nothing\n+\t\t# user-visible has changed yet.\n+\t\t: ;;\n+\tundefined)\n+\t\t# This is not correct; it means the deletion has happened\n+\t\t# already even though update-ref should not have been\n+\t\t# able to acquire the lock yet.\n+\t\techo \"$prefix/foo deleted prematurely\" &&\n+\t\tbreak\n+\t\t;;\n+\t$C)\n+\t\t# This value should never be seen. Probably the loose\n+\t\t# reference has been deleted but the packed reference\n+\t\t# is still there:\n+\t\techo \"$prefix/foo incorrectly observed to be C\" &&\n+\t\tbreak\n+\t\t;;\n+\t*)\n+\t\t# WTF?\n+\t\techo \"unexpected value observed for $prefix/foo: $sha1\" &&\n+\t\tbreak\n+\t\t;;\n+\tesac >out &&\n+\trm -f .git/packed-refs.lock &&\n+\twait $pid2 &&\n+\ttest_must_be_empty out &&\n+\ttest_must_fail git rev-parse --verify --quiet $prefix/foo\n+'\n+\n+test_expect_success 'delete fails cleanly if packed-refs file is locked' '\n+\tprefix=refs/locked-packed-refs &&\n+\t# Set up a reference with differing loose and packed versions:\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tgit update-ref $prefix/foo $D &&\n+\tgit for-each-ref $prefix >unchanged &&\n+\t# Now try to delete it while the `packed-refs` lock is held:\n+\t: >.git/packed-refs.lock &&\n+\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n+\ttest_must_fail git update-ref -d $prefix/foo >out 2>err &&\n+\tgit for-each-ref $prefix >actual &&\n+\ttest_grep \"Unable to create $SQ.*packed-refs.lock$SQ: \" err &&\n+\ttest_cmp unchanged actual\n+'\n+\n+test_expect_success 'delete fails cleanly if packed-refs.new write fails' '\n+\t# Setup and expectations are similar to the test above.\n+\tprefix=refs/failed-packed-refs &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tgit update-ref $prefix/foo $D &&\n+\tgit for-each-ref $prefix >unchanged &&\n+\t# This should not happen in practice, but it is an easy way to get a\n+\t# reliable error (we open with create_tempfile(), which uses O_EXCL).\n+\t: >.git/packed-refs.new &&\n+\ttest_when_finished \"rm -f .git/packed-refs.new\" &&\n+\ttest_must_fail git update-ref -d $prefix/foo &&\n+\tgit for-each-ref $prefix >actual &&\n+\ttest_cmp unchanged actual\n+'\n+\n+test_done\ndiff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\nindex 0369beea33b..6edf3dca9d5 100755\n--- a/t/t1404-update-ref-errors.sh\n+++ b/t/t1404-update-ref-errors.sh\n@@ -34,81 +34,6 @@ test_update_rejected () {\n \ttest_cmp unchanged actual\n }\n \n-# Test adding and deleting D/F-conflicting references in a single\n-# transaction.\n-df_test() {\n-\tprefix=\"$1\"\n-\tpack=: symadd=false symdel=false add_del=false addref= delref=\n-\tshift\n-\twhile test $# -gt 0\n-\tdo\n-\t\tcase \"$1\" in\n-\t\t--pack)\n-\t\t\tpack=\"git pack-refs --all\"\n-\t\t\tshift\n-\t\t\t;;\n-\t\t--sym-add)\n-\t\t\t# Perform the add via a symbolic reference\n-\t\t\tsymadd=true\n-\t\t\tshift\n-\t\t\t;;\n-\t\t--sym-del)\n-\t\t\t# Perform the del via a symbolic reference\n-\t\t\tsymdel=true\n-\t\t\tshift\n-\t\t\t;;\n-\t\t--del-add)\n-\t\t\t# Delete first reference then add second\n-\t\t\tadd_del=false\n-\t\t\tdelref=\"$prefix/r/$2\"\n-\t\t\taddref=\"$prefix/r/$3\"\n-\t\t\tshift 3\n-\t\t\t;;\n-\t\t--add-del)\n-\t\t\t# Add first reference then delete second\n-\t\t\tadd_del=true\n-\t\t\taddref=\"$prefix/r/$2\"\n-\t\t\tdelref=\"$prefix/r/$3\"\n-\t\t\tshift 3\n-\t\t\t;;\n-\t\t*)\n-\t\t\techo 1>&2 \"Extra args to df_test: $*\"\n-\t\t\treturn 1\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\tgit update-ref \"$delref\" $C &&\n-\tif $symadd\n-\tthen\n-\t\taddname=\"$prefix/s/symadd\" &&\n-\t\tgit symbolic-ref \"$addname\" \"$addref\"\n-\telse\n-\t\taddname=\"$addref\"\n-\tfi &&\n-\tif $symdel\n-\tthen\n-\t\tdelname=\"$prefix/s/symdel\" &&\n-\t\tgit symbolic-ref \"$delname\" \"$delref\"\n-\telse\n-\t\tdelname=\"$delref\"\n-\tfi &&\n-\tcat >expected-err <<-EOF &&\n-\tfatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\n-\tEOF\n-\t$pack &&\n-\tif $add_del\n-\tthen\n-\t\tprintf \"%s\\n\" \"create $addname $D\" \"delete $delname\"\n-\telse\n-\t\tprintf \"%s\\n\" \"delete $delname\" \"create $addname $D\"\n-\tfi >commands &&\n-\ttest_must_fail git update-ref --stdin <commands 2>output.err &&\n-\ttest_cmp expected-err output.err &&\n-\tprintf \"%s\\n\" \"$C $delref\" >expected-refs &&\n-\tgit for-each-ref --format=\"%(objectname) %(refname)\" $prefix/r >actual-refs &&\n-\ttest_cmp expected-refs actual-refs\n-}\n-\n test_expect_success 'setup' '\n \n \tgit commit --allow-empty -m Initial &&\n@@ -191,144 +116,6 @@ test_expect_success 'one new ref is a simple prefix of another' '\n \n '\n \n-test_expect_success REFFILES 'empty directory should not fool rev-parse' '\n-\tprefix=refs/e-rev-parse &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\techo \"$C\" >expected &&\n-\tgit rev-parse $prefix/foo >actual &&\n-\ttest_cmp expected actual\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool for-each-ref' '\n-\tprefix=refs/e-for-each-ref &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit for-each-ref $prefix >expected &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tgit for-each-ref $prefix >actual &&\n-\ttest_cmp expected actual\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool create' '\n-\tprefix=refs/e-create &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"create %s $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool verify' '\n-\tprefix=refs/e-verify &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"verify %s $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 1-arg update' '\n-\tprefix=refs/e-update-1 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"update %s $D\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 2-arg update' '\n-\tprefix=refs/e-update-2 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"update %s $D $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 0-arg delete' '\n-\tprefix=refs/e-delete-0 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"delete %s\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 1-arg delete' '\n-\tprefix=refs/e-delete-1 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"delete %s $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '\n-\tdf_test refs/df-al-ds --add-del foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents add short + delete long' '\n-\tdf_test refs/df-as-dl --add-del foo foo/bar\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents delete long + add short' '\n-\tdf_test refs/df-dl-as --del-add foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents delete short + add long' '\n-\tdf_test refs/df-ds-al --del-add foo foo/bar\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents add long + delete short packed' '\n-\tdf_test refs/df-al-dsp --pack --add-del foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents add short + delete long packed' '\n-\tdf_test refs/df-as-dlp --pack --add-del foo foo/bar\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents delete long packed + add short' '\n-\tdf_test refs/df-dlp-as --pack --del-add foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents delete short packed + add long' '\n-\tdf_test refs/df-dsp-al --pack --del-add foo foo/bar\n-'\n-\n-# Try some combinations involving symbolic refs...\n-\n-test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short' '\n-\tdf_test refs/df-ial-ds --sym-add --add-del foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short' '\n-\tdf_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents indirect add short + indirect delete long' '\n-\tdf_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents indirect delete long + indirect add short' '\n-\tdf_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short packed' '\n-\tdf_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short packed' '\n-\tdf_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents add long + indirect delete short packed' '\n-\tdf_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo\n-'\n-\n-test_expect_success REFFILES 'D/F conflict prevents indirect delete long packed + indirect add short' '\n-\tdf_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo\n-'\n-\n # Test various errors when reading the old values of references...\n \n test_expect_success 'missing old value blocks update' '\n@@ -468,169 +255,4 @@ test_expect_success 'incorrect old value blocks indirect no-deref delete' '\n \ttest_cmp expected output.err\n '\n \n-test_expect_success REFFILES 'non-empty directory blocks create' '\n-\tprefix=refs/ne-create &&\n-\tmkdir -p .git/$prefix/foo/bar &&\n-\t: >.git/$prefix/foo/bar/baz.lock &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'broken reference blocks create' '\n-\tprefix=refs/broken-create &&\n-\tmkdir -p .git/$prefix &&\n-\techo \"gobbledigook\" >.git/$prefix/foo &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'non-empty directory blocks indirect create' '\n-\tprefix=refs/ne-indirect-create &&\n-\tgit symbolic-ref $prefix/symref $prefix/foo &&\n-\tmkdir -p .git/$prefix/foo/bar &&\n-\t: >.git/$prefix/foo/bar/baz.lock &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'broken reference blocks indirect create' '\n-\tprefix=refs/broken-indirect-create &&\n-\tgit symbolic-ref $prefix/symref $prefix/foo &&\n-\techo \"gobbledigook\" >.git/$prefix/foo &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'no bogus intermediate values during delete' '\n-\tprefix=refs/slow-transaction &&\n-\t# Set up a reference with differing loose and packed versions:\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tgit update-ref $prefix/foo $D &&\n-\t# Now try to update the reference, but hold the `packed-refs` lock\n-\t# for a while to see what happens while the process is blocked:\n-\t: >.git/packed-refs.lock &&\n-\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n-\t{\n-\t\t# Note: the following command is intentionally run in the\n-\t\t# background. We increase the timeout so that `update-ref`\n-\t\t# attempts to acquire the `packed-refs` lock for much longer\n-\t\t# than it takes for us to do the check then delete it:\n-\t\tgit -c core.packedrefstimeout=30000 update-ref -d $prefix/foo &\n-\t} &&\n-\tpid2=$! &&\n-\t# Give update-ref plenty of time to get to the point where it tries\n-\t# to lock packed-refs:\n-\tsleep 1 &&\n-\t# Make sure that update-ref did not complete despite the lock:\n-\tkill -0 $pid2 &&\n-\t# Verify that the reference still has its old value:\n-\tsha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) &&\n-\tcase \"$sha1\" in\n-\t$D)\n-\t\t# This is what we hope for; it means that nothing\n-\t\t# user-visible has changed yet.\n-\t\t: ;;\n-\tundefined)\n-\t\t# This is not correct; it means the deletion has happened\n-\t\t# already even though update-ref should not have been\n-\t\t# able to acquire the lock yet.\n-\t\techo \"$prefix/foo deleted prematurely\" &&\n-\t\tbreak\n-\t\t;;\n-\t$C)\n-\t\t# This value should never be seen. Probably the loose\n-\t\t# reference has been deleted but the packed reference\n-\t\t# is still there:\n-\t\techo \"$prefix/foo incorrectly observed to be C\" &&\n-\t\tbreak\n-\t\t;;\n-\t*)\n-\t\t# WTF?\n-\t\techo \"unexpected value observed for $prefix/foo: $sha1\" &&\n-\t\tbreak\n-\t\t;;\n-\tesac >out &&\n-\trm -f .git/packed-refs.lock &&\n-\twait $pid2 &&\n-\ttest_must_be_empty out &&\n-\ttest_must_fail git rev-parse --verify --quiet $prefix/foo\n-'\n-\n-test_expect_success REFFILES 'delete fails cleanly if packed-refs file is locked' '\n-\tprefix=refs/locked-packed-refs &&\n-\t# Set up a reference with differing loose and packed versions:\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tgit update-ref $prefix/foo $D &&\n-\tgit for-each-ref $prefix >unchanged &&\n-\t# Now try to delete it while the `packed-refs` lock is held:\n-\t: >.git/packed-refs.lock &&\n-\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n-\ttest_must_fail git update-ref -d $prefix/foo >out 2>err &&\n-\tgit for-each-ref $prefix >actual &&\n-\ttest_grep \"Unable to create $SQ.*packed-refs.lock$SQ: \" err &&\n-\ttest_cmp unchanged actual\n-'\n-\n-test_expect_success REFFILES 'delete fails cleanly if packed-refs.new write fails' '\n-\t# Setup and expectations are similar to the test above.\n-\tprefix=refs/failed-packed-refs &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tgit update-ref $prefix/foo $D &&\n-\tgit for-each-ref $prefix >unchanged &&\n-\t# This should not happen in practice, but it is an easy way to get a\n-\t# reliable error (we open with create_tempfile(), which uses O_EXCL).\n-\t: >.git/packed-refs.new &&\n-\ttest_when_finished \"rm -f .git/packed-refs.new\" &&\n-\ttest_must_fail git update-ref -d $prefix/foo &&\n-\tgit for-each-ref $prefix >actual &&\n-\ttest_cmp unchanged actual\n-'\n-\n test_done\n-- \ngitgitgadget\n\n"},{"id":"486928","messageId":"69ea950cfeacbd2830f216505cdf0de24b108b19.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 06/12] t1406: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:29Z","receivedAt":"2024-01-17T19:52:43Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test to t0600 with the rest of the tests that are specific to\nreffiles. This test reaches into reflog directories manually, and so are\nspecific to reffiles.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh   | 48 +++++++++++++++++++++++++++++++++++\n t/t1407-worktree-ref-store.sh | 37 ---------------------------\n 2 files changed, 48 insertions(+), 37 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 53ac4b9b5b8..09fbe312092 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -403,4 +403,52 @@ test_expect_success 'delete fails cleanly if packed-refs.new write fails' '\n \ttest_cmp unchanged actual\n '\n \n+RWT=\"test-tool ref-store worktree:wt\"\n+RMAIN=\"test-tool ref-store worktree:main\"\n+\n+test_expect_success 'setup worktree' '\n+\ttest_commit first &&\n+\tgit worktree add -b wt-main wt &&\n+\t(\n+\t\tcd wt &&\n+\t\ttest_commit second\n+\t)\n+'\n+\n+# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should\n+# only appear in the for-each-reflog output if it is called from the correct\n+# worktree, which is exercised in this test. This test is poorly written for\n+# mulitple reasons: 1) it creates invalidly formatted log entres. 2) it uses\n+# direct FS access for creating the reflogs. 3) PSEUDO-WT and refs/bisect/random\n+# do not create reflogs by default, so it is not testing a realistic scenario.\n+test_expect_success 'for_each_reflog()' '\n+\techo $ZERO_OID > .git/logs/PSEUDO-MAIN &&\n+\tmkdir -p     .git/logs/refs/bisect &&\n+\techo $ZERO_OID > .git/logs/refs/bisect/random &&\n+\n+\techo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&\n+\tmkdir -p     .git/worktrees/wt/logs/refs/bisect &&\n+\techo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&\n+\n+\t$RWT for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n+\tcat >expected <<-\\EOF &&\n+\tHEAD 0x1\n+\tPSEUDO-WT 0x0\n+\trefs/bisect/wt-random 0x0\n+\trefs/heads/main 0x0\n+\trefs/heads/wt-main 0x0\n+\tEOF\n+\ttest_cmp expected actual &&\n+\n+\t$RMAIN for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n+\tcat >expected <<-\\EOF &&\n+\tHEAD 0x1\n+\tPSEUDO-MAIN 0x0\n+\trefs/bisect/random 0x0\n+\trefs/heads/main 0x0\n+\trefs/heads/wt-main 0x0\n+\tEOF\n+\ttest_cmp expected actual\n+'\n+\n test_done\ndiff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh\nindex 05b1881c591..48b1c92a414 100755\n--- a/t/t1407-worktree-ref-store.sh\n+++ b/t/t1407-worktree-ref-store.sh\n@@ -53,41 +53,4 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' '\n \ttest_cmp expected actual\n '\n \n-# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should\n-# only appear in the for-each-reflog output if it is called from the correct\n-# worktree, which is exercised in this test. This test is poorly written (and\n-# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly\n-# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3)\n-# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is\n-# not testing a realistic scenario.\n-test_expect_success REFFILES 'for_each_reflog()' '\n-\techo $ZERO_OID > .git/logs/PSEUDO-MAIN &&\n-\tmkdir -p     .git/logs/refs/bisect &&\n-\techo $ZERO_OID > .git/logs/refs/bisect/random &&\n-\n-\techo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&\n-\tmkdir -p     .git/worktrees/wt/logs/refs/bisect &&\n-\techo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&\n-\n-\t$RWT for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n-\tcat >expected <<-\\EOF &&\n-\tHEAD 0x1\n-\tPSEUDO-WT 0x0\n-\trefs/bisect/wt-random 0x0\n-\trefs/heads/main 0x0\n-\trefs/heads/wt-main 0x0\n-\tEOF\n-\ttest_cmp expected actual &&\n-\n-\t$RMAIN for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n-\tcat >expected <<-\\EOF &&\n-\tHEAD 0x1\n-\tPSEUDO-MAIN 0x0\n-\trefs/bisect/random 0x0\n-\trefs/heads/main 0x0\n-\trefs/heads/wt-main 0x0\n-\tEOF\n-\ttest_cmp expected actual\n-'\n-\n test_done\n-- \ngitgitgadget\n\n"},{"id":"486929","messageId":"ae71747871cf97e8f0fb802836e0e5c7ae961696.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 07/12] t1410: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:30Z","receivedAt":"2024-01-17T19:52:44Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove these tests to t0600 with other reffiles specific tests since they\ndo things like take a lock on an individual ref, and write directly into\nthe reflog refs\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 51 +++++++++++++++++++++++++++++++++++++\n t/t1410-reflog.sh           | 42 ------------------------------\n 2 files changed, 51 insertions(+), 42 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 09fbe312092..0b28a2cc5ea 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -451,4 +451,55 @@ test_expect_success 'for_each_reflog()' '\n \ttest_cmp expected actual\n '\n \n+# Triggering the bug detected by this test requires a newline to fall\n+# exactly BUFSIZ-1 bytes from the end of the file. We don't know\n+# what that value is, since it's platform dependent. However, if\n+# we choose some value N, we also catch any D which divides N evenly\n+# (since we will read backwards in chunks of D). So we choose 8K,\n+# which catches glibc (with an 8K BUFSIZ) and *BSD (1K).\n+#\n+# Each line is 114 characters, so we need 75 to still have a few before the\n+# last 8K. The 89-character padding on the final entry lines up our\n+# newline exactly.\n+test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' '\n+\tgit checkout -b reflogskip &&\n+\tzf=$(test_oid zero_2) &&\n+\tident=\"abc <xyz> 0000000001 +0000\" &&\n+\tfor i in $(test_seq 1 75); do\n+\t\tprintf \"$zf%02d $zf%02d %s\\t\" $i $(($i+1)) \"$ident\" &&\n+\t\tif test $i = 75; then\n+\t\t\tfor j in $(test_seq 1 89); do\n+\t\t\t\tprintf X || return 1\n+\t\t\tdone\n+\t\telse\n+\t\t\tprintf X\n+\t\tfi &&\n+\t\tprintf \"\\n\" || return 1\n+\tdone >.git/logs/refs/heads/reflogskip &&\n+\tgit rev-parse reflogskip@{73} >actual &&\n+\techo ${zf}03 >expect &&\n+\ttest_cmp expect actual\n+'\n+\n+# This test takes a lock on an individual ref; this is not supported in\n+# reftable.\n+test_expect_success 'reflog expire operates on symref not referrent' '\n+\tgit branch --create-reflog the_symref &&\n+\tgit branch --create-reflog referrent &&\n+\tgit update-ref referrent HEAD &&\n+\tgit symbolic-ref refs/heads/the_symref refs/heads/referrent &&\n+\ttest_when_finished \"rm -f .git/refs/heads/referrent.lock\" &&\n+\ttouch .git/refs/heads/referrent.lock &&\n+\tgit reflog expire --expire=all the_symref\n+'\n+\n+test_expect_success 'empty reflog' '\n+\ttest_when_finished \"rm -rf empty\" &&\n+\tgit init empty &&\n+\ttest_commit -C empty A &&\n+\t>empty/.git/logs/refs/heads/foo &&\n+\tgit -C empty reflog expire --all 2>err &&\n+\ttest_must_be_empty err\n+'\n+\n test_done\ndiff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh\nindex a0ff8d51f04..d2f5f42e674 100755\n--- a/t/t1410-reflog.sh\n+++ b/t/t1410-reflog.sh\n@@ -354,36 +354,6 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '\n \ttest_must_be_empty actual\n '\n \n-# Triggering the bug detected by this test requires a newline to fall\n-# exactly BUFSIZ-1 bytes from the end of the file. We don't know\n-# what that value is, since it's platform dependent. However, if\n-# we choose some value N, we also catch any D which divides N evenly\n-# (since we will read backwards in chunks of D). So we choose 8K,\n-# which catches glibc (with an 8K BUFSIZ) and *BSD (1K).\n-#\n-# Each line is 114 characters, so we need 75 to still have a few before the\n-# last 8K. The 89-character padding on the final entry lines up our\n-# newline exactly.\n-test_expect_success REFFILES,SHA1 'parsing reverse reflogs at BUFSIZ boundaries' '\n-\tgit checkout -b reflogskip &&\n-\tzf=$(test_oid zero_2) &&\n-\tident=\"abc <xyz> 0000000001 +0000\" &&\n-\tfor i in $(test_seq 1 75); do\n-\t\tprintf \"$zf%02d $zf%02d %s\\t\" $i $(($i+1)) \"$ident\" &&\n-\t\tif test $i = 75; then\n-\t\t\tfor j in $(test_seq 1 89); do\n-\t\t\t\tprintf X || return 1\n-\t\t\tdone\n-\t\telse\n-\t\t\tprintf X\n-\t\tfi &&\n-\t\tprintf \"\\n\" || return 1\n-\tdone >.git/logs/refs/heads/reflogskip &&\n-\tgit rev-parse reflogskip@{73} >actual &&\n-\techo ${zf}03 >expect &&\n-\ttest_cmp expect actual\n-'\n-\n test_expect_success 'no segfaults for reflog containing non-commit sha1s' '\n \tgit update-ref --create-reflog -m \"Creating ref\" \\\n \t\trefs/tests/tree-in-reflog HEAD &&\n@@ -397,18 +367,6 @@ test_expect_failure 'reflog with non-commit entries displays all entries' '\n \ttest_line_count = 3 actual\n '\n \n-# This test takes a lock on an individual ref; this is not supported in\n-# reftable.\n-test_expect_success REFFILES 'reflog expire operates on symref not referrent' '\n-\tgit branch --create-reflog the_symref &&\n-\tgit branch --create-reflog referrent &&\n-\tgit update-ref referrent HEAD &&\n-\tgit symbolic-ref refs/heads/the_symref refs/heads/referrent &&\n-\ttest_when_finished \"rm -f .git/refs/heads/referrent.lock\" &&\n-\ttouch .git/refs/heads/referrent.lock &&\n-\tgit reflog expire --expire=all the_symref\n-'\n-\n test_expect_success 'continue walking past root commits' '\n \tgit init orphanage &&\n \t(\n-- \ngitgitgadget\n\n"},{"id":"486930","messageId":"9d10526369525a0ceee2d75742399130ccf885ce.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 08/12] t1415: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:31Z","receivedAt":"2024-01-17T19:52:45Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test into t0600 with other reffiles specific tests since it\nchecks for individua loose refs and thus is specific to the reffiles\nbackend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 20 ++++++++++++++++++++\n t/t1415-worktree-refs.sh    | 11 -----------\n 2 files changed, 20 insertions(+), 11 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 0b28a2cc5ea..8526e5cf987 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -502,4 +502,24 @@ test_expect_success 'empty reflog' '\n \ttest_must_be_empty err\n '\n \n+# The 'packed-refs' file is stored directly in .git/. This means it is global\n+# to the repository, and can only contain refs that are shared across all\n+# worktrees.\n+test_expect_success 'refs/worktree must not be packed' '\n+\ttest_commit initial &&\n+\ttest_commit wt1 &&\n+\ttest_commit wt2 &&\n+\tgit worktree add wt1 wt1 &&\n+\tgit worktree add wt2 wt2 &&\n+\tgit checkout initial &&\n+\tgit update-ref refs/worktree/foo HEAD &&\n+\tgit -C wt1 update-ref refs/worktree/foo HEAD &&\n+\tgit -C wt2 update-ref refs/worktree/foo HEAD &&\n+\tgit pack-refs --all &&\n+\ttest_path_is_missing .git/refs/tags/wt1 &&\n+\ttest_path_is_file .git/refs/worktree/foo &&\n+\ttest_path_is_file .git/worktrees/wt1/refs/worktree/foo &&\n+\ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n+'\n+\n test_done\ndiff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh\nindex 3b531842dd4..eb4eec8becb 100755\n--- a/t/t1415-worktree-refs.sh\n+++ b/t/t1415-worktree-refs.sh\n@@ -17,17 +17,6 @@ test_expect_success 'setup' '\n \tgit -C wt2 update-ref refs/worktree/foo HEAD\n '\n \n-# The 'packed-refs' file is stored directly in .git/. This means it is global\n-# to the repository, and can only contain refs that are shared across all\n-# worktrees.\n-test_expect_success REFFILES 'refs/worktree must not be packed' '\n-\tgit pack-refs --all &&\n-\ttest_path_is_missing .git/refs/tags/wt1 &&\n-\ttest_path_is_file .git/refs/worktree/foo &&\n-\ttest_path_is_file .git/worktrees/wt1/refs/worktree/foo &&\n-\ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n-'\n-\n test_expect_success 'refs/worktree are per-worktree' '\n \ttest_cmp_rev worktree/foo initial &&\n \t( cd wt1 && test_cmp_rev worktree/foo wt1 ) &&\n-- \ngitgitgadget\n\n"},{"id":"486931","messageId":"dcec7f10ab67f33dd0de87e74698cd222f18603f.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 09/12] t1503: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:32Z","receivedAt":"2024-01-17T19:52:45Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test to t0600 with other reffiles specific tests since it\nchecks for loose refs and is specific to the reffiles backend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 5 +++++\n t/t1503-rev-parse-verify.sh | 5 -----\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 8526e5cf987..704b73fdc54 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -522,4 +522,9 @@ test_expect_success 'refs/worktree must not be packed' '\n \ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n '\n \n+test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n+       ln -s does-not-exist .git/refs/heads/broken &&\n+       test_must_fail git rev-parse --verify broken\n+'\n+\n test_done\ndiff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh\nindex bc136833c10..79df65ec7f6 100755\n--- a/t/t1503-rev-parse-verify.sh\n+++ b/t/t1503-rev-parse-verify.sh\n@@ -144,11 +144,6 @@ test_expect_success 'main@{n} for various n' '\n \ttest_must_fail git rev-parse --verify main@{$Np1}\n '\n \n-test_expect_success SYMLINKS,REFFILES 'ref resolution not confused by broken symlinks' '\n-\tln -s does-not-exist .git/refs/heads/broken &&\n-\ttest_must_fail git rev-parse --verify broken\n-'\n-\n test_expect_success 'options can appear after --verify' '\n \tgit rev-parse --verify HEAD >expect &&\n \tgit rev-parse --verify -q HEAD >actual &&\n-- \ngitgitgadget\n\n"},{"id":"486932","messageId":"56a9c8f20dd7c8f3e9401b2bd3929fb9c53c7d27.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 10/12] t3903: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:33Z","receivedAt":"2024-01-17T19:52:46Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test into t0600 with other reffiles specific tests since it\nmodifies reflog refs manually and thus is specific to the reffiles\nbackend.\n\nThis change also consolidates setup_stash() into test-lib-functions.sh\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++\n t/t3903-stash.sh            | 43 -------------------------------------\n t/test-lib-functions.sh     | 16 ++++++++++++++\n 3 files changed, 43 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 704b73fdc54..bee61b2d19d 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n        test_must_fail git rev-parse --verify broken\n '\n \n+test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsetup_stash\n+\t) &&\n+\techo 9 >repo/file &&\n+\n+\told_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n+\tgit -C repo stash &&\n+\tnew_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n+\n+\tcat >expect <<-EOF &&\n+\t$(test_oid zero) $old_oid\n+\t$old_oid $new_oid\n+\tEOF\n+\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n+\ttest_cmp expect actual &&\n+\n+\tgit -C repo stash drop stash@{1} &&\n+\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n+\tcat >expect <<-EOF &&\n+\t$(test_oid zero) $new_oid\n+\tEOF\n+\ttest_cmp expect actual\n+'\n+\n test_done\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 34faeac3f1c..0b0e7b19fdc 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -42,22 +42,6 @@ diff_cmp () {\n \trm -f \"$1.compare\" \"$2.compare\"\n }\n \n-setup_stash() {\n-\techo 1 >file &&\n-\tgit add file &&\n-\techo unrelated >other-file &&\n-\tgit add other-file &&\n-\ttest_tick &&\n-\tgit commit -m initial &&\n-\techo 2 >file &&\n-\tgit add file &&\n-\techo 3 >file &&\n-\ttest_tick &&\n-\tgit stash &&\n-\tgit diff-files --quiet &&\n-\tgit diff-index --cached --quiet HEAD\n-}\n-\n test_expect_success 'stash some dirty working directory' '\n \tsetup_stash\n '\n@@ -200,33 +184,6 @@ test_expect_success 'drop stash reflog updates refs/stash' '\n \ttest_cmp expect actual\n '\n \n-test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' '\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsetup_stash\n-\t) &&\n-\techo 9 >repo/file &&\n-\n-\told_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n-\tgit -C repo stash &&\n-\tnew_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n-\n-\tcat >expect <<-EOF &&\n-\t$(test_oid zero) $old_oid\n-\t$old_oid $new_oid\n-\tEOF\n-\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n-\ttest_cmp expect actual &&\n-\n-\tgit -C repo stash drop stash@{1} &&\n-\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n-\tcat >expect <<-EOF &&\n-\t$(test_oid zero) $new_oid\n-\tEOF\n-\ttest_cmp expect actual\n-'\n-\n test_expect_success 'stash pop' '\n \tgit reset --hard &&\n \tgit stash pop &&\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex b5eaf7fdc11..68a6c8402d0 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1958,3 +1958,19 @@ test_trailing_hash () {\n \t\ttest-tool hexdump |\n \t\tsed \"s/ //g\"\n }\n+\n+# Stash some changes\n+setup_stash() { echo 1 >file &&\n+\tgit add file &&\n+\techo unrelated >other-file &&\n+\tgit add other-file &&\n+\ttest_tick &&\n+\tgit commit -m initial &&\n+\techo 2 >file &&\n+\tgit add file &&\n+\techo 3 >file &&\n+\ttest_tick &&\n+\tgit stash &&\n+\tgit diff-files --quiet &&\n+\tgit diff-index --cached --quiet HEAD\n+}\n-- \ngitgitgadget\n\n"},{"id":"486933","messageId":"39e69fde3d70220e03e3e103f46bc7c089cf2136.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 11/12] t4202: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:34Z","receivedAt":"2024-01-17T19:52:47Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove two tests into t0600 since they write loose reflog refs manually\nand thus are specific to the reffiles backend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 17 +++++++++++++++++\n t/t4202-log.sh              | 17 -----------------\n 2 files changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex bee61b2d19d..c88576dfea5 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -554,4 +554,21 @@ test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'log diagnoses bogus HEAD hash' '\n+\tgit init empty &&\n+\ttest_when_finished \"rm -rf empty\" &&\n+\techo 1234abcd >empty/.git/refs/heads/main &&\n+\ttest_must_fail git -C empty log 2>stderr &&\n+\ttest_grep broken stderr\n+'\n+\n+test_expect_success 'log diagnoses bogus HEAD symref' '\n+\tgit init empty &&\n+\ttest-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock &&\n+\ttest_must_fail git -C empty log 2>stderr &&\n+\ttest_grep broken stderr &&\n+\ttest_must_fail git -C empty log --default totally-bogus 2>stderr &&\n+\ttest_grep broken stderr\n+'\n+\n test_done\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex ddd205f98ab..60fe60d7610 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -2255,23 +2255,6 @@ test_expect_success 'log on empty repo fails' '\n \ttest_grep does.not.have.any.commits stderr\n '\n \n-test_expect_success REFFILES 'log diagnoses bogus HEAD hash' '\n-\tgit init empty &&\n-\ttest_when_finished \"rm -rf empty\" &&\n-\techo 1234abcd >empty/.git/refs/heads/main &&\n-\ttest_must_fail git -C empty log 2>stderr &&\n-\ttest_grep broken stderr\n-'\n-\n-test_expect_success REFFILES 'log diagnoses bogus HEAD symref' '\n-\tgit init empty &&\n-\ttest-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock &&\n-\ttest_must_fail git -C empty log 2>stderr &&\n-\ttest_grep broken stderr &&\n-\ttest_must_fail git -C empty log --default totally-bogus 2>stderr &&\n-\ttest_grep broken stderr\n-'\n-\n test_expect_success 'log does not default to HEAD when rev input is given' '\n \tgit log --branches=does-not-exist >actual &&\n \ttest_must_be_empty actual\n-- \ngitgitgadget\n\n"},{"id":"486934","messageId":"316a20ed17950e4e45d7ea13d8f6e8d4e064821e.1705521155.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH 12/12] t5312: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-17T19:52:35Z","receivedAt":"2024-01-17T19:52:48Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove a few tests into t0600 since they specifically test the packed-refs\nfile and thus are specific to the reffiles backend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 30 ++++++++++++++++++++++++++++++\n t/t5312-prune-corruption.sh | 26 --------------------------\n 2 files changed, 30 insertions(+), 26 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex c88576dfea5..190155f592d 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -571,4 +571,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' '\n \ttest_grep broken stderr\n '\n \n+# we do not want to count on running pack-refs to\n+# actually pack it, as it is perfectly reasonable to\n+# skip processing a broken ref\n+test_expect_success 'create packed-refs file with broken ref' '\n+\ttest_tick && git commit --allow-empty -m one &&\n+\trecoverable=$(git rev-parse HEAD) &&\n+\ttest_tick && git commit --allow-empty -m two &&\n+\tmissing=$(git rev-parse HEAD) &&\n+\trm -f .git/refs/heads/main &&\n+\tcat >.git/packed-refs <<-EOF &&\n+\t$missing refs/heads/main\n+\t$recoverable refs/heads/other\n+\tEOF\n+\techo $missing >expect &&\n+\tgit rev-parse refs/heads/main >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'pack-refs does not silently delete broken packed ref' '\n+\tgit pack-refs --all --prune &&\n+\tgit rev-parse refs/heads/main >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success  'pack-refs does not drop broken refs during deletion' '\n+\tgit update-ref -d refs/heads/other &&\n+\tgit rev-parse refs/heads/main >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\ndiff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh\nindex 230cb387122..d8d2e304687 100755\n--- a/t/t5312-prune-corruption.sh\n+++ b/t/t5312-prune-corruption.sh\n@@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '\n \ttest_cmp expect actual\n '\n \n-# we do not want to count on running pack-refs to\n-# actually pack it, as it is perfectly reasonable to\n-# skip processing a broken ref\n-test_expect_success REFFILES 'create packed-refs file with broken ref' '\n-\trm -f .git/refs/heads/main &&\n-\tcat >.git/packed-refs <<-EOF &&\n-\t$missing refs/heads/main\n-\t$recoverable refs/heads/other\n-\tEOF\n-\techo $missing >expect &&\n-\tgit rev-parse refs/heads/main >actual &&\n-\ttest_cmp expect actual\n-'\n-\n-test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' '\n-\tgit pack-refs --all --prune &&\n-\tgit rev-parse refs/heads/main >actual &&\n-\ttest_cmp expect actual\n-'\n-\n-test_expect_success REFFILES  'pack-refs does not drop broken refs during deletion' '\n-\tgit update-ref -d refs/heads/other &&\n-\tgit rev-parse refs/heads/main >actual &&\n-\ttest_cmp expect actual\n-'\n-\n test_done\n-- \ngitgitgadget\n"},{"id":"486945","messageId":"xmqqil3rtqxh.fsf@gitster.g","threadId":"60756","inReplyTo":"0e2b6e197ab2fbfc81a42fd601b6aaf41e38929f.1705521155.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 01/12] t3210: move to t0602","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-18T00:40:10Z","receivedAt":"2024-01-18T00:40:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: John Cai <johncai86@gmail.com>\n>\n> Move t3210 to t0602, since these tests are reffiles specific in that\n> they modify loose refs manually. This is part of the effort to\n> categorize these tests together based on the ref backend they test. When\n> we upstream the reftable backend, we can add more tests to t06xx. This\n> way, all tests that test specific ref backend behavior will be grouped\n> together.\n\nSo, ... is the idea to have (1) majority of ref tests, against which\nall backends ought to behave the same way, will be written in\nbackend agnostic way (e.g., we have seen some patches to stop\ntouching the filesystem .git/refs/ hierarchy manually), and (2) some\nbackend specific tests will be grouped in a small number of test\nscript files for each backend and they all will use t6xx numbrs?\n\nOK.  Sounds like a good plan to me.\n\n\n\n\n> Signed-off-by: John Cai <johncai86@gmail.com>\n> ---\n>  t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0\n>  1 file changed, 0 insertions(+), 0 deletions(-)\n>  rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)\n>\n> diff --git a/t/t3210-pack-refs.sh b/t/t0602-reffiles-pack-refs.sh\n> similarity index 100%\n> rename from t/t3210-pack-refs.sh\n> rename to t/t0602-reffiles-pack-refs.sh\n"},{"id":"486946","messageId":"xmqqedeftqn7.fsf@gitster.g","threadId":"60756","inReplyTo":"624ad202305138c312e9db7d9cc590baf4e576ab.1705521155.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 02/12] remove REFFILES prerequisite","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-18T00:46:20Z","receivedAt":"2024-01-18T00:46:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: John Cai <johncai86@gmail.com>\n>\n> These tests are compatible with the reftable backend and thus do not\n> need the REFFILES prerequisite.\n\nMay want to give a bit more backstory here?  After all, 53af25e4\n(t1405: mark test that checks existence as REFFILES, 2022-01-31) and\n53af25e4 (t1405: mark test that checks existence as REFFILES,\n2022-01-31) marked these tests to require REFFILES and they explain\nthe reason for doing so was exactly because the reftable backend did\nnot have the notion of \"the reflog for this ref exists\" that is\nindependent from \"the reflog for this ref exists and has one or more\nreflog records\".  If your work on the reftable backend during the\npast few years added support for \"already exists, but there is no\nentry yet\" state for reflogs, that would be great, but it would make\nsense to explain why they suddenly have become \"compatible with the\nreftable backend\".\n\nThanks.\n\n>\n> Signed-off-by: John Cai <johncai86@gmail.com>\n> ---\n>  t/t1405-main-ref-store.sh  | 2 +-\n>  t/t2017-checkout-orphan.sh | 2 +-\n>  2 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh\n> index e4627cf1b61..62c1eadb190 100755\n> --- a/t/t1405-main-ref-store.sh\n> +++ b/t/t1405-main-ref-store.sh\n> @@ -112,7 +112,7 @@ test_expect_success 'delete_reflog(HEAD)' '\n>  \ttest_must_fail git reflog exists HEAD\n>  '\n>  \n> -test_expect_success REFFILES 'create-reflog(HEAD)' '\n> +test_expect_success 'create-reflog(HEAD)' '\n>  \t$RUN create-reflog HEAD &&\n>  \tgit reflog exists HEAD\n>  '\n> diff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh\n> index 947d1587ac8..a5c7358eeab 100755\n> --- a/t/t2017-checkout-orphan.sh\n> +++ b/t/t2017-checkout-orphan.sh\n> @@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' '\n>  \tgit rev-parse --verify delta@{0}\n>  '\n>  \n> -test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' '\n> +test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '\n>  \tgit checkout main &&\n>  \tgit config core.logAllRefUpdates false &&\n>  \tgit checkout --orphan epsilon &&\n"},{"id":"486947","messageId":"xmqq7ck7tq6e.fsf@gitster.g","threadId":"60756","inReplyTo":"19233aa0d4496b66d67fbee82fb8d9b6b35a03cb.1705521155.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 03/12] t1414: convert test to use Git commands instead of writing refs manually","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-18T00:56:25Z","receivedAt":"2024-01-18T00:56:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n>  # Create a situation where the reflog and ref database disagree about the latest\n>  # state of HEAD.\n> -test_expect_success REFFILES 'walk prefers reflog to ref tip' '\n> +test_expect_success 'walk prefers reflog to ref tip' '\n> +\ttest_commit A &&\n> +\ttest_commit B &&\n> +\tgit reflog delete HEAD@{0} &&\n>  \thead=$(git rev-parse HEAD) &&\n> +\tA=$(git rev-parse A) &&\n>  \n> +\techo $A >expect &&\n\nYou do not need an intermediate variable A, i.e.\n\n\tgit rev-parse A >expect &&\n\nwould suffice.  Also it seems that $head is no longer used\nbecause you do not manufacture a reflog entry yourself, so the two\nassignments to $A and $head can be removed.\n\n>  \tgit log -g --format=%H -1 >actual &&\n>  \ttest_cmp expect actual\n>  '\n\nThe resulting code makes the intent of the test much clearer.\nNicely done.\n"},{"id":"486949","messageId":"xmqqv87rsan6.fsf@gitster.g","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"Re: [PATCH 00/12] Group reffiles tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-18T01:17:17Z","receivedAt":"2024-01-18T01:17:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> This series groups REFFILES specific tests together. These tests are\n> currently grouped together across the test suite based on functionality.\n> However, since they exercise low-level behavior specific to the refs backend\n> being used (in these cases, the ref-files backend), group them together\n> based on which refs backend they test. This way, in the near future when the\n> reftables backend gets upstreamed we can add tests that exercise the\n> reftables backend close by in the t06xx area.\n>\n> These patches also remove the REFFILES prerequisite, since all the tests in\n> t06xx are reffiles specific.\n\nAs we already have REFFILES lazy prereq, even _before_ we enable the\nreftable backend, I think that we should start t0600 and t0602 with\n\n\t. ./test-lib.sh\n\tif ! test_have_prereq REFFILES\n\tthen\n\t\tskip_all='skipping reffiles specific tests'\n\t\ttest_done\n\tfi\n\nwhich is more in line with the existing convention.  It is more\nefficient than \"forcing t0600 and t0602 to run always with reffiles\"\nwhen you have a CI job that uses reftable for all tests and another\nCI job that uses reffiles for all tests.\n\n> In the near future, once the reftable backend is upstreamed, all\n> the tests in t06xx will be forced to run with the reffiles\n> backend.\n\nPresumably if there are reftable backend specific tests, they will\nalso be given names out of t06xx range, right?  And then they will\nbe skipped when the test is not using reftable as the default ref\nbackend, using the REFTABLE prerequisite in a similar way as shown\nabove for REFFILES, right?\n\nThanks.\n\n"},{"id":"486969","messageId":"ZakJz_Kj5-tlKL_U@tanuki","threadId":"60756","inReplyTo":"xmqqedeftqn7.fsf@gitster.g","subject":"Re: [PATCH 02/12] remove REFFILES prerequisite","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-18T11:21:51Z","receivedAt":"2024-01-18T11:21:56Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jan 17, 2024 at 04:46:20PM -0800, Junio C Hamano wrote:\n> \"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n> > From: John Cai <johncai86@gmail.com>\n> >\n> > These tests are compatible with the reftable backend and thus do not\n> > need the REFFILES prerequisite.\n> \n> May want to give a bit more backstory here?  After all, 53af25e4\n> (t1405: mark test that checks existence as REFFILES, 2022-01-31) and\n> 53af25e4 (t1405: mark test that checks existence as REFFILES,\n> 2022-01-31) marked these tests to require REFFILES and they explain\n> the reason for doing so was exactly because the reftable backend did\n> not have the notion of \"the reflog for this ref exists\" that is\n> independent from \"the reflog for this ref exists and has one or more\n> reflog records\".  If your work on the reftable backend during the\n> past few years added support for \"already exists, but there is no\n> entry yet\" state for reflogs, that would be great, but it would make\n> sense to explain why they suddenly have become \"compatible with the\n> reftable backend\".\n\nI don't know a lot about the history any why we initially didn't think\nit would be compatible, mostly because there is no history of how the\nreftable backend itself evolved over time. I can only say that when I\ntook over the effort that this indeed worked as expected by writing\n\"existence\" markers into the reflog, where this existence marker is a\nsimple entry where both old and new object ID are set to the null OID.\n\nPatrick\n"},{"id":"486970","messageId":"ZakMQP3r44eVc5Dh@tanuki","threadId":"60756","inReplyTo":"xmqqil3rtqxh.fsf@gitster.g","subject":"Re: [PATCH 01/12] t3210: move to t0602","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-18T11:32:16Z","receivedAt":"2024-01-18T11:32:22Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jan 17, 2024 at 04:40:10PM -0800, Junio C Hamano wrote:\n> \"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n> > From: John Cai <johncai86@gmail.com>\n> >\n> > Move t3210 to t0602, since these tests are reffiles specific in that\n> > they modify loose refs manually. This is part of the effort to\n> > categorize these tests together based on the ref backend they test. When\n> > we upstream the reftable backend, we can add more tests to t06xx. This\n> > way, all tests that test specific ref backend behavior will be grouped\n> > together.\n> \n> So, ... is the idea to have (1) majority of ref tests, against which\n> all backends ought to behave the same way, will be written in\n> backend agnostic way (e.g., we have seen some patches to stop\n> touching the filesystem .git/refs/ hierarchy manually), and (2) some\n> backend specific tests will be grouped in a small number of test\n> script files for each backend and they all will use t6xx numbrs?\n> \n> OK.  Sounds like a good plan to me.\n\nYes, that's the plan. The backend specific tests will be free to also\nexercise filesystem-level behaviour in order to pin down that things\nwork as expected. But once their behaviour is nailed down all other\ngeneric tests should refrain from doing that to the best extent possible\nand instead use Git commands to do their thing.\n\n> > Signed-off-by: John Cai <johncai86@gmail.com>\n> > ---\n> >  t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0\n> >  1 file changed, 0 insertions(+), 0 deletions(-)\n> >  rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)\n\nIs there a reason why you picked t0602 instead of the not-yet-taken\nt0601? If it's only because I use t0601 in my reftable integration\nbranch then I'd like us to pick t0601 here instead to avoid a weird gap.\nI'll adapt accordingly and rename the reftable tests to have a t061x\nprefix in that case so that they are nicely grouped together.\n\nPatrick\n"},{"id":"486971","messageId":"ZakNqm0zyw8IiIhB@tanuki","threadId":"60756","inReplyTo":"xmqqv87rsan6.fsf@gitster.g","subject":"Re: [PATCH 00/12] Group reffiles tests","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-18T11:38:18Z","receivedAt":"2024-01-18T11:38:23Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jan 17, 2024 at 05:17:17PM -0800, Junio C Hamano wrote:\n> \"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n> > This series groups REFFILES specific tests together. These tests are\n> > currently grouped together across the test suite based on functionality.\n> > However, since they exercise low-level behavior specific to the refs backend\n> > being used (in these cases, the ref-files backend), group them together\n> > based on which refs backend they test. This way, in the near future when the\n> > reftables backend gets upstreamed we can add tests that exercise the\n> > reftables backend close by in the t06xx area.\n> >\n> > These patches also remove the REFFILES prerequisite, since all the tests in\n> > t06xx are reffiles specific.\n> \n> As we already have REFFILES lazy prereq, even _before_ we enable the\n> reftable backend, I think that we should start t0600 and t0602 with\n> \n> \t. ./test-lib.sh\n> \tif ! test_have_prereq REFFILES\n> \tthen\n> \t\tskip_all='skipping reffiles specific tests'\n> \t\ttest_done\n> \tfi\n> \n> which is more in line with the existing convention.  It is more\n> efficient than \"forcing t0600 and t0602 to run always with reffiles\"\n> when you have a CI job that uses reftable for all tests and another\n> CI job that uses reffiles for all tests.\n\nI think it depends. If we use the REFFILES prereq for the files-specific\ntests, then we should likely also use the REFTABLE prereq for the\nreftable-specific tests.\n\nBut that raises the question of whether we want to add a CI job that\nexercises code with the reftable backend for every major platform\n(Linux, macOS, Windows). If so then your proposal would be fine with me\nas we make sure that things work alright on all of them. But if we think\nthat this would be too expensive then I'd like to at least have very\nbasic test coverage on all platforms by always running these\nbackend-specific tests.\n\nPatrick\n"},{"id":"486987","messageId":"31D22360-5F20-43BD-B8FC-0BA2BC3A2EA9@gmail.com","threadId":"60756","inReplyTo":"ZakMQP3r44eVc5Dh@tanuki","subject":"Re: [PATCH 01/12] t3210: move to t0602","fromName":"John Cai","fromEmail":"johncai86@gmail.com","sentAt":"2024-01-18T16:25:13Z","receivedAt":"2024-01-18T16:25:16Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"Hi Patrick,\n\nOn 18 Jan 2024, at 6:32, Patrick Steinhardt wrote:\n\n> On Wed, Jan 17, 2024 at 04:40:10PM -0800, Junio C Hamano wrote:\n>> \"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>>\n>>> From: John Cai <johncai86@gmail.com>\n>>>\n>>> Move t3210 to t0602, since these tests are reffiles specific in that\n>>> they modify loose refs manually. This is part of the effort to\n>>> categorize these tests together based on the ref backend they test. When\n>>> we upstream the reftable backend, we can add more tests to t06xx. This\n>>> way, all tests that test specific ref backend behavior will be grouped\n>>> together.\n>>\n>> So, ... is the idea to have (1) majority of ref tests, against which\n>> all backends ought to behave the same way, will be written in\n>> backend agnostic way (e.g., we have seen some patches to stop\n>> touching the filesystem .git/refs/ hierarchy manually), and (2) some\n>> backend specific tests will be grouped in a small number of test\n>> script files for each backend and they all will use t6xx numbrs?\n>>\n>> OK.  Sounds like a good plan to me.\n>\n> Yes, that's the plan. The backend specific tests will be free to also\n> exercise filesystem-level behaviour in order to pin down that things\n> work as expected. But once their behaviour is nailed down all other\n> generic tests should refrain from doing that to the best extent possible\n> and instead use Git commands to do their thing.\n>\n>>> Signed-off-by: John Cai <johncai86@gmail.com>\n>>> ---\n>>>  t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0\n>>>  1 file changed, 0 insertions(+), 0 deletions(-)\n>>>  rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)\n>\n> Is there a reason why you picked t0602 instead of the not-yet-taken\n> t0601? If it's only because I use t0601 in my reftable integration\n> branch then I'd like us to pick t0601 here instead to avoid a weird gap.\n> I'll adapt accordingly and rename the reftable tests to have a t061x\n> prefix in that case so that they are nicely grouped together.\n\nYes if I remember correctly, that's the reason. I can move this to t0601 then,\nthanks.\n\n>\n> Patrick\n"},{"id":"486994","messageId":"xmqqmst2qun9.fsf@gitster.g","threadId":"60756","inReplyTo":"ZakNqm0zyw8IiIhB@tanuki","subject":"Re: [PATCH 00/12] Group reffiles tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-18T20:00:26Z","receivedAt":"2024-01-18T20:00:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> I think it depends. If we use the REFFILES prereq for the files-specific\n> tests, then we should likely also use the REFTABLE prereq for the\n> reftable-specific tests.\n\nCorrect.  I've assumed that as a given; while introducing any new\nimplementation of a subsystem that has widespread impact, we would\ntest things with the original and new implementations.  It happened\nwhile we were moving \"ort\" to replace \"recursive\" as an internal\ntree merge machinery, for example.  linux-TEST-vars job that is\navailable both in GitHub and GitLab CI is an example of a separate\njob that runs everything with non-default configurations, and \"use\nreftable as the default backend\" GIT_TEST_REFTABLE knob may be an\nappropriate thing to set there.\n\n> But that raises the question of whether we want to add a CI job that\n> exercises code with the reftable backend for every major platform\n> (Linux, macOS, Windows). If so then your proposal would be fine with me\n> as we make sure that things work alright on all of them. But if we think\n> that this would be too expensive then I'd like to at least have very\n> basic test coverage on all platforms by always running these\n> backend-specific tests.\n>\n> Patrick\n"},{"id":"487067","messageId":"Zap4pGuoC6G9DCHa@tanuki","threadId":"60756","inReplyTo":"0f6fea6d32d242db772fbee0b4aaec044087f53d.1705521155.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 04/12] t1404: move reffiles specific tests to t0600","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-19T13:27:00Z","receivedAt":"2024-01-19T13:27:06Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jan 17, 2024 at 07:52:27PM +0000, John Cai via GitGitGadget wrote:\n> From: John Cai <johncai86@gmail.com>\n[snip]\n> +test_expect_success 'D/F conflict prevents add long + delete short' '\n> +\tdf_test refs/df-al-ds --add-del foo/bar foo\n> +'\n\nAll of the tests using `df_test ()` pass with the reftable backend, the\nonly thing that's incompatible is that there is an additional prefix in\nthe \"files\" backend's error message. So I'd like to drop moving those\nD/F conflict tests so that we can instead make them generic in another\niteration.\n\nAll the other tests where we verify how the \"files\" backend behaves when\nthere are empty directories in the way do make sense to become backend\nspecific though.\n\nPatrick\n"},{"id":"487068","messageId":"Zap5LM78CdeK5mTR@tanuki","threadId":"60756","inReplyTo":"9d10526369525a0ceee2d75742399130ccf885ce.1705521155.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 08/12] t1415: move reffiles specific tests to t0600","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-19T13:29:16Z","receivedAt":"2024-01-19T13:29:21Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jan 17, 2024 at 07:52:31PM +0000, John Cai via GitGitGadget wrote:\n> From: John Cai <johncai86@gmail.com>\n> \n> Move this test into t0600 with other reffiles specific tests since it\n> checks for individua loose refs and thus is specific to the reffiles\n> backend.\n> \n> Signed-off-by: John Cai <johncai86@gmail.com>\n> ---\n>  t/t0600-reffiles-backend.sh | 20 ++++++++++++++++++++\n>  t/t1415-worktree-refs.sh    | 11 -----------\n>  2 files changed, 20 insertions(+), 11 deletions(-)\n> \n> diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\n> index 0b28a2cc5ea..8526e5cf987 100755\n> --- a/t/t0600-reffiles-backend.sh\n> +++ b/t/t0600-reffiles-backend.sh\n> @@ -502,4 +502,24 @@ test_expect_success 'empty reflog' '\n>  \ttest_must_be_empty err\n>  '\n>  \n> +# The 'packed-refs' file is stored directly in .git/. This means it is global\n> +# to the repository, and can only contain refs that are shared across all\n> +# worktrees.\n> +test_expect_success 'refs/worktree must not be packed' '\n> +\ttest_commit initial &&\n> +\ttest_commit wt1 &&\n> +\ttest_commit wt2 &&\n> +\tgit worktree add wt1 wt1 &&\n> +\tgit worktree add wt2 wt2 &&\n> +\tgit checkout initial &&\n> +\tgit update-ref refs/worktree/foo HEAD &&\n> +\tgit -C wt1 update-ref refs/worktree/foo HEAD &&\n> +\tgit -C wt2 update-ref refs/worktree/foo HEAD &&\n> +\tgit pack-refs --all &&\n> +\ttest_path_is_missing .git/refs/tags/wt1 &&\n> +\ttest_path_is_file .git/refs/worktree/foo &&\n> +\ttest_path_is_file .git/worktrees/wt1/refs/worktree/foo &&\n> +\ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n> +'\n\nGiven that this test exercises git-pack-refs(1), should we move it to\nt0601-reffiles-pack-refs.sh instead?\n\nPatrick\n"},{"id":"487070","messageId":"Zap7jfZlwlm-UZ1X@tanuki","threadId":"60756","inReplyTo":"56a9c8f20dd7c8f3e9401b2bd3929fb9c53c7d27.1705521155.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 10/12] t3903: move reffiles specific tests to t0600","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-19T13:39:25Z","receivedAt":"2024-01-19T13:39:30Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jan 17, 2024 at 07:52:33PM +0000, John Cai via GitGitGadget wrote:\n> From: John Cai <johncai86@gmail.com>\n> \n> Move this test into t0600 with other reffiles specific tests since it\n> modifies reflog refs manually and thus is specific to the reffiles\n> backend.\n> \n> This change also consolidates setup_stash() into test-lib-functions.sh\n> \n> Signed-off-by: John Cai <johncai86@gmail.com>\n> ---\n>  t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++\n>  t/t3903-stash.sh            | 43 -------------------------------------\n>  t/test-lib-functions.sh     | 16 ++++++++++++++\n>  3 files changed, 43 insertions(+), 43 deletions(-)\n> \n> diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\n> index 704b73fdc54..bee61b2d19d 100755\n> --- a/t/t0600-reffiles-backend.sh\n> +++ b/t/t0600-reffiles-backend.sh\n> @@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n>         test_must_fail git rev-parse --verify broken\n>  '\n>  \n> +test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n> +\tgit init repo &&\n> +\t(\n> +\t\tcd repo &&\n> +\t\tsetup_stash\n> +\t) &&\n> +\techo 9 >repo/file &&\n> +\n> +\told_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n> +\tgit -C repo stash &&\n> +\tnew_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n> +\n> +\tcat >expect <<-EOF &&\n> +\t$(test_oid zero) $old_oid\n> +\t$old_oid $new_oid\n> +\tEOF\n> +\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n> +\ttest_cmp expect actual &&\n> +\n> +\tgit -C repo stash drop stash@{1} &&\n> +\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n> +\tcat >expect <<-EOF &&\n> +\t$(test_oid zero) $new_oid\n> +\tEOF\n> +\ttest_cmp expect actual\n> +'\n\nI think that there is no need to make this backend-specific. What we're\ntesting here is that `git stash drop` is able to drop the latest reflog\nentry. The calls to cut(1) are only used to verify that the contents of\nthe reflog entry look as expected while only verifying the old and new\nobject IDs.\n\nSo how about below patch to make it generic instead?\n\nPatrick\n\n-- >8 --\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 34faeac3f1..3319240515 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' '\n \ttest_cmp expect actual\n '\n \n-test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' '\n+test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n \tgit init repo &&\n \t(\n \t\tcd repo &&\n@@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite'\n \tnew_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n \n \tcat >expect <<-EOF &&\n-\t$(test_oid zero) $old_oid\n-\t$old_oid $new_oid\n+\t$new_oid\n+\t$old_oid\n \tEOF\n-\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n+\tgit -C repo reflog show refs/stash --format=%H >actual &&\n \ttest_cmp expect actual &&\n \n \tgit -C repo stash drop stash@{1} &&\n-\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n+\tgit -C repo reflog show refs/stash --format=%H >actual &&\n \tcat >expect <<-EOF &&\n-\t$(test_oid zero) $new_oid\n+\t$new_oid\n \tEOF\n \ttest_cmp expect actual\n '\n"},{"id":"487071","messageId":"Zap7wPW8qwHRuCM0@tanuki","threadId":"60756","inReplyTo":"316a20ed17950e4e45d7ea13d8f6e8d4e064821e.1705521155.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 12/12] t5312: move reffiles specific tests to t0600","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-19T13:40:16Z","receivedAt":"2024-01-19T13:40:21Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jan 17, 2024 at 07:52:35PM +0000, John Cai via GitGitGadget wrote:\n> From: John Cai <johncai86@gmail.com>\n> \n> Move a few tests into t0600 since they specifically test the packed-refs\n> file and thus are specific to the reffiles backend.\n> \n> Signed-off-by: John Cai <johncai86@gmail.com>\n> ---\n>  t/t0600-reffiles-backend.sh | 30 ++++++++++++++++++++++++++++++\n>  t/t5312-prune-corruption.sh | 26 --------------------------\n>  2 files changed, 30 insertions(+), 26 deletions(-)\n> \n> diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\n> index c88576dfea5..190155f592d 100755\n> --- a/t/t0600-reffiles-backend.sh\n> +++ b/t/t0600-reffiles-backend.sh\n> @@ -571,4 +571,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' '\n>  \ttest_grep broken stderr\n>  '\n>  \n> +# we do not want to count on running pack-refs to\n> +# actually pack it, as it is perfectly reasonable to\n> +# skip processing a broken ref\n> +test_expect_success 'create packed-refs file with broken ref' '\n> +\ttest_tick && git commit --allow-empty -m one &&\n> +\trecoverable=$(git rev-parse HEAD) &&\n> +\ttest_tick && git commit --allow-empty -m two &&\n> +\tmissing=$(git rev-parse HEAD) &&\n> +\trm -f .git/refs/heads/main &&\n> +\tcat >.git/packed-refs <<-EOF &&\n> +\t$missing refs/heads/main\n> +\t$recoverable refs/heads/other\n> +\tEOF\n> +\techo $missing >expect &&\n> +\tgit rev-parse refs/heads/main >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n> +test_expect_success 'pack-refs does not silently delete broken packed ref' '\n> +\tgit pack-refs --all --prune &&\n> +\tgit rev-parse refs/heads/main >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n> +test_expect_success  'pack-refs does not drop broken refs during deletion' '\n> +\tgit update-ref -d refs/heads/other &&\n> +\tgit rev-parse refs/heads/main >actual &&\n> +\ttest_cmp expect actual\n> +'\n\nShould these tests be moved into t0601-reffiles-pack-refs.sh instead?\n\nPatrick\n"},{"id":"487078","messageId":"06EEFC6C-5ACE-49D7-AF24-C0D950241E86@gmail.com","threadId":"60756","inReplyTo":"Zap7jfZlwlm-UZ1X@tanuki","subject":"Re: [PATCH 10/12] t3903: move reffiles specific tests to t0600","fromName":"John Cai","fromEmail":"johncai86@gmail.com","sentAt":"2024-01-19T15:47:05Z","receivedAt":"2024-01-19T15:47:07Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"Hi Patrick,\n\nOn 19 Jan 2024, at 8:39, Patrick Steinhardt wrote:\n\n> On Wed, Jan 17, 2024 at 07:52:33PM +0000, John Cai via GitGitGadget wrote:\n>> From: John Cai <johncai86@gmail.com>\n>>\n>> Move this test into t0600 with other reffiles specific tests since it\n>> modifies reflog refs manually and thus is specific to the reffiles\n>> backend.\n>>\n>> This change also consolidates setup_stash() into test-lib-functions.sh\n>>\n>> Signed-off-by: John Cai <johncai86@gmail.com>\n>> ---\n>>  t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++\n>>  t/t3903-stash.sh            | 43 -------------------------------------\n>>  t/test-lib-functions.sh     | 16 ++++++++++++++\n>>  3 files changed, 43 insertions(+), 43 deletions(-)\n>>\n>> diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\n>> index 704b73fdc54..bee61b2d19d 100755\n>> --- a/t/t0600-reffiles-backend.sh\n>> +++ b/t/t0600-reffiles-backend.sh\n>> @@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n>>         test_must_fail git rev-parse --verify broken\n>>  '\n>>\n>> +test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n>> +\tgit init repo &&\n>> +\t(\n>> +\t\tcd repo &&\n>> +\t\tsetup_stash\n>> +\t) &&\n>> +\techo 9 >repo/file &&\n>> +\n>> +\told_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n>> +\tgit -C repo stash &&\n>> +\tnew_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n>> +\n>> +\tcat >expect <<-EOF &&\n>> +\t$(test_oid zero) $old_oid\n>> +\t$old_oid $new_oid\n>> +\tEOF\n>> +\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n>> +\ttest_cmp expect actual &&\n>> +\n>> +\tgit -C repo stash drop stash@{1} &&\n>> +\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n>> +\tcat >expect <<-EOF &&\n>> +\t$(test_oid zero) $new_oid\n>> +\tEOF\n>> +\ttest_cmp expect actual\n>> +'\n>\n> I think that there is no need to make this backend-specific. What we're\n> testing here is that `git stash drop` is able to drop the latest reflog\n> entry. The calls to cut(1) are only used to verify that the contents of\n> the reflog entry look as expected while only verifying the old and new\n> object IDs.\n>\n> So how about below patch to make it generic instead?\n\nNice catch. This sounds perfect to me.\n\n>\n> Patrick\n>\n> -- >8 --\n>\n> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\n> index 34faeac3f1..3319240515 100755\n> --- a/t/t3903-stash.sh\n> +++ b/t/t3903-stash.sh\n> @@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' '\n>  \ttest_cmp expect actual\n>  '\n>\n> -test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' '\n> +test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n>  \tgit init repo &&\n>  \t(\n>  \t\tcd repo &&\n> @@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite'\n>  \tnew_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n>\n>  \tcat >expect <<-EOF &&\n> -\t$(test_oid zero) $old_oid\n> -\t$old_oid $new_oid\n> +\t$new_oid\n> +\t$old_oid\n>  \tEOF\n> -\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n> +\tgit -C repo reflog show refs/stash --format=%H >actual &&\n>  \ttest_cmp expect actual &&\n>\n>  \tgit -C repo stash drop stash@{1} &&\n> -\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n> +\tgit -C repo reflog show refs/stash --format=%H >actual &&\n>  \tcat >expect <<-EOF &&\n> -\t$(test_oid zero) $new_oid\n> +\t$new_oid\n>  \tEOF\n>  \ttest_cmp expect actual\n>  '\n"},{"id":"487090","messageId":"ca65b9e6122d10a7b43d06a6069dae00e645a392.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 01/12] t3210: move to t0601","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:49Z","receivedAt":"2024-01-19T20:19:04Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove t3210 to t0601, since these tests are reffiles specific in that\nthey modify loose refs manually. This is part of the effort to\ncategorize these tests together based on the ref backend they test. When\nwe upstream the reftable backend, we can add more tests to t06xx. This\nway, all tests that test specific ref backend behavior will be grouped\ntogether.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} | 6 ++++++\n 1 file changed, 6 insertions(+)\n rename t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} (98%)\n\ndiff --git a/t/t3210-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh\nsimilarity index 98%\nrename from t/t3210-pack-refs.sh\nrename to t/t0601-reffiles-pack-refs.sh\nindex 7f4e98db7db..f7a3f693901 100755\n--- a/t/t3210-pack-refs.sh\n+++ b/t/t0601-reffiles-pack-refs.sh\n@@ -15,6 +15,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n TEST_PASSES_SANITIZE_LEAK=true\n . ./test-lib.sh\n \n+if ! test_have_prereq REFFILES\n+\tthen\n+\t\tskip_all='skipping reffiles specific tests'\n+\t\ttest_done\n+fi\n+\n test_expect_success 'enable reflogs' '\n \tgit config core.logallrefupdates true\n '\n-- \ngitgitgadget\n\n"},{"id":"487091","messageId":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.git.git.1705521155.gitgitgadget@gmail.com","subject":"[PATCH v2 00/12] Group reffiles tests","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:48Z","receivedAt":"2024-01-19T20:19:04Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"This series groups REFFILES specific tests together. These tests are\ncurrently grouped together across the test suite based on functionality.\nHowever, since they exercise low-level behavior specific to the refs backend\nbeing used (in these cases, the ref-files backend), group them together\nbased on which refs backend they test. This way, in the near future when the\nreftables backend gets upstreamed we can add tests that exercise the\nreftables backend close by in the t06xx area.\n\nThese patches also remove the REFFILES prerequisite, since all the tests in\nt06xx are reffiles specific. In the near future, once the reftable backend\nis upstreamed, all the tests in t06xx will be forced to run with the\nreffiles backend.\n\nChanges since V1:\n\n * Moved some pack-refs tests to t0601 instead of t0600\n * Clarified some commit messages\n * Converted a test to be refs-backend agnostic\n * Other minor rearranging of tests\n\nJohn Cai (12):\n  t3210: move to t0601\n  remove REFFILES prerequisite for some tests in t1405 and t2017\n  t1414: convert test to use Git commands instead of writing refs\n    manually\n  t1404: move reffiles specific tests to t0600\n  t1405: move reffiles specific tests to t0601\n  t1406: move reffiles specific tests to t0600\n  t1410: move reffiles specific tests to t0600\n  t1415: move reffiles specific tests to t0601\n  t1503: move reffiles specific tests to t0600\n  t3903: make drop stash test ref backend agnostic\n  t4202: move reffiles specific tests to t0600\n  t5312: move reffiles specific tests to t0601\n\n t/t0600-reffiles-backend.sh                   | 384 ++++++++++++++++++\n ...ck-refs.sh => t0601-reffiles-pack-refs.sh} |  64 +++\n t/t1404-update-ref-errors.sh                  | 237 -----------\n t/t1405-main-ref-store.sh                     |  10 +-\n t/t1407-worktree-ref-store.sh                 |  37 --\n t/t1410-reflog.sh                             |  42 --\n t/t1414-reflog-walk.sh                        |  11 +-\n t/t1415-worktree-refs.sh                      |  11 -\n t/t1503-rev-parse-verify.sh                   |   5 -\n t/t2017-checkout-orphan.sh                    |   2 +-\n t/t3903-stash.sh                              |  12 +-\n t/t4202-log.sh                                |  17 -\n t/t5312-prune-corruption.sh                   |  26 --\n 13 files changed, 461 insertions(+), 397 deletions(-)\n create mode 100755 t/t0600-reffiles-backend.sh\n rename t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} (81%)\n\n\nbase-commit: 186b115d3062e6230ee296d1ddaa0c4b72a464b5\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1647%2Fjohn-cai%2Fjc%2Fgroup-reffiles-tests-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1647/john-cai/jc/group-reffiles-tests-v2\nPull-Request: https://github.com/git/git/pull/1647\n\nRange-diff vs v1:\n\n  1:  0e2b6e197ab <  -:  ----------- t3210: move to t0602\n  -:  ----------- >  1:  ca65b9e6122 t3210: move to t0601\n  2:  624ad202305 !  2:  29c32d3e6f7 remove REFFILES prerequisite\n     @@ Metadata\n      Author: John Cai <johncai86@gmail.com>\n      \n       ## Commit message ##\n     -    remove REFFILES prerequisite\n     +    remove REFFILES prerequisite for some tests in t1405 and t2017\n      \n          These tests are compatible with the reftable backend and thus do not\n     -    need the REFFILES prerequisite.\n     +    need the REFFILES prerequisite. Even though 53af25e4\n     +    (t1405: mark test that checks existence as REFFILES, 2022-01-31) and\n     +    53af25e4 (t1405: mark test that checks existence as REFFILES,\n     +    2022-01-31) marked these tests to require REFFILES, the reftable backend\n     +    in its current state does indeed work with these tests.\n      \n          Signed-off-by: John Cai <johncai86@gmail.com>\n      \n  3:  19233aa0d44 !  3:  122d19a9095 t1414: convert test to use Git commands instead of writing refs manually\n     @@ t/t1414-reflog-walk.sh: test_expect_success 'min/max age uses entry date to limi\n      -\tone=$(git rev-parse one) &&\n      -\tident=\"$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\" &&\n      -\techo \"$head $one $ident\tbroken reflog entry\" >>.git/logs/HEAD &&\n     -+\tA=$(git rev-parse A) &&\n     - \n     +-\n      -\techo $one >expect &&\n     -+\techo $A >expect &&\n     ++\tgit rev-parse A >expect &&\n       \tgit log -g --format=%H -1 >actual &&\n       \ttest_cmp expect actual\n       '\n  4:  0f6fea6d32d !  4:  c3f0b81200c t1404: move reffiles specific tests to t0600\n     @@ t/t0600-reffiles-backend.sh (new)\n      +TEST_PASSES_SANITIZE_LEAK=true\n      +. ./test-lib.sh\n      +\n     -+# Test adding and deleting D/F-conflicting references in a single\n     -+# transaction.\n     -+df_test() {\n     -+\tprefix=\"$1\"\n     -+\tpack=: symadd=false symdel=false add_del=false addref= delref=\n     -+\tshift\n     -+\twhile test $# -gt 0\n     -+\tdo\n     -+\t\tcase \"$1\" in\n     -+\t\t--pack)\n     -+\t\t\tpack=\"git pack-refs --all\"\n     -+\t\t\tshift\n     -+\t\t\t;;\n     -+\t\t--sym-add)\n     -+\t\t\t# Perform the add via a symbolic reference\n     -+\t\t\tsymadd=true\n     -+\t\t\tshift\n     -+\t\t\t;;\n     -+\t\t--sym-del)\n     -+\t\t\t# Perform the del via a symbolic reference\n     -+\t\t\tsymdel=true\n     -+\t\t\tshift\n     -+\t\t\t;;\n     -+\t\t--del-add)\n     -+\t\t\t# Delete first reference then add second\n     -+\t\t\tadd_del=false\n     -+\t\t\tdelref=\"$prefix/r/$2\"\n     -+\t\t\taddref=\"$prefix/r/$3\"\n     -+\t\t\tshift 3\n     -+\t\t\t;;\n     -+\t\t--add-del)\n     -+\t\t\t# Add first reference then delete second\n     -+\t\t\tadd_del=true\n     -+\t\t\taddref=\"$prefix/r/$2\"\n     -+\t\t\tdelref=\"$prefix/r/$3\"\n     -+\t\t\tshift 3\n     -+\t\t\t;;\n     -+\t\t*)\n     -+\t\t\techo 1>&2 \"Extra args to df_test: $*\"\n     -+\t\t\treturn 1\n     -+\t\t\t;;\n     -+\t\tesac\n     -+\tdone\n     -+\tgit update-ref \"$delref\" $C &&\n     -+\tif $symadd\n     ++if ! test_have_prereq REFFILES\n      +\tthen\n     -+\t\taddname=\"$prefix/s/symadd\" &&\n     -+\t\tgit symbolic-ref \"$addname\" \"$addref\"\n     -+\telse\n     -+\t\taddname=\"$addref\"\n     -+\tfi &&\n     -+\tif $symdel\n     -+\tthen\n     -+\t\tdelname=\"$prefix/s/symdel\" &&\n     -+\t\tgit symbolic-ref \"$delname\" \"$delref\"\n     -+\telse\n     -+\t\tdelname=\"$delref\"\n     -+\tfi &&\n     -+\tcat >expected-err <<-EOF &&\n     -+\tfatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\n     -+\tEOF\n     -+\t$pack &&\n     -+\tif $add_del\n     -+\tthen\n     -+\t\tprintf \"%s\\n\" \"create $addname $D\" \"delete $delname\"\n     -+\telse\n     -+\t\tprintf \"%s\\n\" \"delete $delname\" \"create $addname $D\"\n     -+\tfi >commands &&\n     -+\ttest_must_fail git update-ref --stdin <commands 2>output.err &&\n     -+\ttest_cmp expected-err output.err &&\n     -+\tprintf \"%s\\n\" \"$C $delref\" >expected-refs &&\n     -+\tgit for-each-ref --format=\"%(objectname) %(refname)\" $prefix/r >actual-refs &&\n     -+\ttest_cmp expected-refs actual-refs\n     -+}\n     ++\t\tskip_all='skipping reffiles specific tests'\n     ++\t\ttest_done\n     ++fi\n      +\n      +test_expect_success 'setup' '\n      +\tgit commit --allow-empty -m Initial &&\n     @@ t/t0600-reffiles-backend.sh (new)\n      +\tgit update-ref --stdin\n      +'\n      +\n     -+test_expect_success 'D/F conflict prevents add long + delete short' '\n     -+\tdf_test refs/df-al-ds --add-del foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents add short + delete long' '\n     -+\tdf_test refs/df-as-dl --add-del foo foo/bar\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents delete long + add short' '\n     -+\tdf_test refs/df-dl-as --del-add foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents delete short + add long' '\n     -+\tdf_test refs/df-ds-al --del-add foo foo/bar\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents add long + delete short packed' '\n     -+\tdf_test refs/df-al-dsp --pack --add-del foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents add short + delete long packed' '\n     -+\tdf_test refs/df-as-dlp --pack --add-del foo foo/bar\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents delete long packed + add short' '\n     -+\tdf_test refs/df-dlp-as --pack --del-add foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents delete short packed + add long' '\n     -+\tdf_test refs/df-dsp-al --pack --del-add foo foo/bar\n     -+'\n     -+\n     -+# Try some combinations involving symbolic refs...\n     -+\n     -+test_expect_success 'D/F conflict prevents indirect add long + delete short' '\n     -+\tdf_test refs/df-ial-ds --sym-add --add-del foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' '\n     -+\tdf_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' '\n     -+\tdf_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' '\n     -+\tdf_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents indirect add long + delete short packed' '\n     -+\tdf_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' '\n     -+\tdf_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents add long + indirect delete short packed' '\n     -+\tdf_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo\n     -+'\n     -+\n     -+test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' '\n     -+\tdf_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo\n     -+'\n     -+\n      +test_expect_success 'non-empty directory blocks create' '\n      +\tprefix=refs/ne-create &&\n      +\tmkdir -p .git/$prefix/foo/bar &&\n     @@ t/t0600-reffiles-backend.sh (new)\n      +test_done\n      \n       ## t/t1404-update-ref-errors.sh ##\n     -@@ t/t1404-update-ref-errors.sh: test_update_rejected () {\n     - \ttest_cmp unchanged actual\n     - }\n     - \n     --# Test adding and deleting D/F-conflicting references in a single\n     --# transaction.\n     --df_test() {\n     --\tprefix=\"$1\"\n     --\tpack=: symadd=false symdel=false add_del=false addref= delref=\n     --\tshift\n     --\twhile test $# -gt 0\n     --\tdo\n     --\t\tcase \"$1\" in\n     --\t\t--pack)\n     --\t\t\tpack=\"git pack-refs --all\"\n     --\t\t\tshift\n     --\t\t\t;;\n     --\t\t--sym-add)\n     --\t\t\t# Perform the add via a symbolic reference\n     --\t\t\tsymadd=true\n     --\t\t\tshift\n     --\t\t\t;;\n     --\t\t--sym-del)\n     --\t\t\t# Perform the del via a symbolic reference\n     --\t\t\tsymdel=true\n     --\t\t\tshift\n     --\t\t\t;;\n     --\t\t--del-add)\n     --\t\t\t# Delete first reference then add second\n     --\t\t\tadd_del=false\n     --\t\t\tdelref=\"$prefix/r/$2\"\n     --\t\t\taddref=\"$prefix/r/$3\"\n     --\t\t\tshift 3\n     --\t\t\t;;\n     --\t\t--add-del)\n     --\t\t\t# Add first reference then delete second\n     --\t\t\tadd_del=true\n     --\t\t\taddref=\"$prefix/r/$2\"\n     --\t\t\tdelref=\"$prefix/r/$3\"\n     --\t\t\tshift 3\n     --\t\t\t;;\n     --\t\t*)\n     --\t\t\techo 1>&2 \"Extra args to df_test: $*\"\n     --\t\t\treturn 1\n     --\t\t\t;;\n     --\t\tesac\n     --\tdone\n     --\tgit update-ref \"$delref\" $C &&\n     --\tif $symadd\n     --\tthen\n     --\t\taddname=\"$prefix/s/symadd\" &&\n     --\t\tgit symbolic-ref \"$addname\" \"$addref\"\n     --\telse\n     --\t\taddname=\"$addref\"\n     --\tfi &&\n     --\tif $symdel\n     --\tthen\n     --\t\tdelname=\"$prefix/s/symdel\" &&\n     --\t\tgit symbolic-ref \"$delname\" \"$delref\"\n     --\telse\n     --\t\tdelname=\"$delref\"\n     --\tfi &&\n     --\tcat >expected-err <<-EOF &&\n     --\tfatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\n     --\tEOF\n     --\t$pack &&\n     --\tif $add_del\n     --\tthen\n     --\t\tprintf \"%s\\n\" \"create $addname $D\" \"delete $delname\"\n     --\telse\n     --\t\tprintf \"%s\\n\" \"delete $delname\" \"create $addname $D\"\n     --\tfi >commands &&\n     --\ttest_must_fail git update-ref --stdin <commands 2>output.err &&\n     --\ttest_cmp expected-err output.err &&\n     --\tprintf \"%s\\n\" \"$C $delref\" >expected-refs &&\n     --\tgit for-each-ref --format=\"%(objectname) %(refname)\" $prefix/r >actual-refs &&\n     --\ttest_cmp expected-refs actual-refs\n     --}\n     --\n     - test_expect_success 'setup' '\n     - \n     - \tgit commit --allow-empty -m Initial &&\n      @@ t/t1404-update-ref-errors.sh: test_expect_success 'one new ref is a simple prefix of another' '\n       \n       '\n     @@ t/t1404-update-ref-errors.sh: test_expect_success 'one new ref is a simple prefi\n      -\tgit update-ref --stdin\n      -'\n      -\n     --test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '\n     --\tdf_test refs/df-al-ds --add-del foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents add short + delete long' '\n     --\tdf_test refs/df-as-dl --add-del foo foo/bar\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents delete long + add short' '\n     --\tdf_test refs/df-dl-as --del-add foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents delete short + add long' '\n     --\tdf_test refs/df-ds-al --del-add foo foo/bar\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents add long + delete short packed' '\n     --\tdf_test refs/df-al-dsp --pack --add-del foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents add short + delete long packed' '\n     --\tdf_test refs/df-as-dlp --pack --add-del foo foo/bar\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents delete long packed + add short' '\n     --\tdf_test refs/df-dlp-as --pack --del-add foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents delete short packed + add long' '\n     --\tdf_test refs/df-dsp-al --pack --del-add foo foo/bar\n     --'\n     --\n     --# Try some combinations involving symbolic refs...\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short' '\n     --\tdf_test refs/df-ial-ds --sym-add --add-del foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short' '\n     --\tdf_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents indirect add short + indirect delete long' '\n     --\tdf_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents indirect delete long + indirect add short' '\n     --\tdf_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short packed' '\n     --\tdf_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short packed' '\n     --\tdf_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents add long + indirect delete short packed' '\n     --\tdf_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo\n     --'\n     --\n     --test_expect_success REFFILES 'D/F conflict prevents indirect delete long packed + indirect add short' '\n     --\tdf_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo\n     --'\n     --\n     - # Test various errors when reading the old values of references...\n     - \n     - test_expect_success 'missing old value blocks update' '\n     + test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '\n     + \tdf_test refs/df-al-ds --add-del foo/bar foo\n     + '\n      @@ t/t1404-update-ref-errors.sh: test_expect_success 'incorrect old value blocks indirect no-deref delete' '\n       \ttest_cmp expected output.err\n       '\n  5:  c2af695f551 !  5:  42dc9948aa5 t1405: move reffiles specific tests to t0600\n     @@ Metadata\n      Author: John Cai <johncai86@gmail.com>\n      \n       ## Commit message ##\n     -    t1405: move reffiles specific tests to t0600\n     +    t1405: move reffiles specific tests to t0601\n      \n     -    Move this test to t0600 with other reffiles specific tests since it is\n     -    reffiles specific in that it looks into the loose refs directory for an\n     -    assertion.\n     +    Move this test to t0601 with other reffiles specific pack-refs tests\n     +    since it is reffiles specific in that it looks into the loose refs\n     +    directory for an assertion.\n      \n          Signed-off-by: John Cai <johncai86@gmail.com>\n      \n     - ## t/t0600-reffiles-backend.sh ##\n     -@@ t/t0600-reffiles-backend.sh: test_expect_success 'setup' '\n     - \tE=$(git rev-parse HEAD)\n     + ## t/t0601-reffiles-pack-refs.sh ##\n     +@@ t/t0601-reffiles-pack-refs.sh: test_expect_success 'prepare a trivial repository' '\n     + \tHEAD=$(git rev-parse --verify HEAD)\n       '\n       \n      +test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '\n     @@ t/t0600-reffiles-backend.sh: test_expect_success 'setup' '\n      +\ttest -z \"$N\"\n      +'\n      +\n     - test_expect_success 'empty directory should not fool rev-parse' '\n     - \tprefix=refs/e-rev-parse &&\n     - \tgit update-ref $prefix/foo $C &&\n     + SHA1=\n     + \n     + test_expect_success 'see if git show-ref works as expected' '\n      \n       ## t/t1405-main-ref-store.sh ##\n      @@ t/t1405-main-ref-store.sh: test_expect_success 'setup' '\n  6:  69ea950cfea =  6:  98e40a024b9 t1406: move reffiles specific tests to t0600\n  7:  ae71747871c =  7:  d93c9c410b9 t1410: move reffiles specific tests to t0600\n  8:  9d105263695 !  8:  8327b12a313 t1415: move reffiles specific tests to t0600\n     @@ Metadata\n      Author: John Cai <johncai86@gmail.com>\n      \n       ## Commit message ##\n     -    t1415: move reffiles specific tests to t0600\n     +    t1415: move reffiles specific tests to t0601\n      \n     -    Move this test into t0600 with other reffiles specific tests since it\n     -    checks for individua loose refs and thus is specific to the reffiles\n     -    backend.\n     +    Move this test into t0601 with other reffiles pack-refs specific tests\n     +    since it checks for individua loose refs and thus is specific to the\n     +    reffiles backend.\n      \n          Signed-off-by: John Cai <johncai86@gmail.com>\n      \n     - ## t/t0600-reffiles-backend.sh ##\n     -@@ t/t0600-reffiles-backend.sh: test_expect_success 'empty reflog' '\n     - \ttest_must_be_empty err\n     + ## t/t0601-reffiles-pack-refs.sh ##\n     +@@ t/t0601-reffiles-pack-refs.sh: test_expect_success SYMLINKS 'pack symlinked packed-refs' '\n     + \ttest \"$(test_readlink .git/packed-refs)\" = \"my-deviant-packed-refs\"\n       '\n       \n      +# The 'packed-refs' file is stored directly in .git/. This means it is global\n  9:  dcec7f10ab6 !  9:  891a3d057d2 t1503: move reffiles specific tests to t0600\n     @@ Commit message\n          Signed-off-by: John Cai <johncai86@gmail.com>\n      \n       ## t/t0600-reffiles-backend.sh ##\n     -@@ t/t0600-reffiles-backend.sh: test_expect_success 'refs/worktree must not be packed' '\n     - \ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n     +@@ t/t0600-reffiles-backend.sh: test_expect_success 'empty reflog' '\n     + \ttest_must_be_empty err\n       '\n       \n      +test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n 10:  56a9c8f20dd <  -:  ----------- t3903: move reffiles specific tests to t0600\n  -:  ----------- > 10:  bfd5b403170 t3903: make drop stash test ref backend agnostic\n 11:  39e69fde3d7 ! 11:  976be7efc89 t4202: move reffiles specific tests to t0600\n     @@ Commit message\n          Signed-off-by: John Cai <johncai86@gmail.com>\n      \n       ## t/t0600-reffiles-backend.sh ##\n     -@@ t/t0600-reffiles-backend.sh: test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n     - \ttest_cmp expect actual\n     +@@ t/t0600-reffiles-backend.sh: test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n     +        test_must_fail git rev-parse --verify broken\n       '\n       \n      +test_expect_success 'log diagnoses bogus HEAD hash' '\n 12:  316a20ed179 ! 12:  7329e87148a t5312: move reffiles specific tests to t0600\n     @@ Metadata\n      Author: John Cai <johncai86@gmail.com>\n      \n       ## Commit message ##\n     -    t5312: move reffiles specific tests to t0600\n     +    t5312: move reffiles specific tests to t0601\n      \n     -    Move a few tests into t0600 since they specifically test the packed-refs\n     +    Move a few tests into t0601 since they specifically test the packed-refs\n          file and thus are specific to the reffiles backend.\n      \n          Signed-off-by: John Cai <johncai86@gmail.com>\n      \n     - ## t/t0600-reffiles-backend.sh ##\n     -@@ t/t0600-reffiles-backend.sh: test_expect_success 'log diagnoses bogus HEAD symref' '\n     - \ttest_grep broken stderr\n     + ## t/t0601-reffiles-pack-refs.sh ##\n     +@@ t/t0601-reffiles-pack-refs.sh: test_expect_success 'refs/worktree must not be packed' '\n     + \ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n       '\n       \n      +# we do not want to count on running pack-refs to\n     @@ t/t0600-reffiles-backend.sh: test_expect_success 'log diagnoses bogus HEAD symre\n      +\ttest_cmp expect actual\n      +'\n      +\n     -+test_expect_success  'pack-refs does not drop broken refs during deletion' '\n     ++test_expect_success 'pack-refs does not drop broken refs during deletion' '\n      +\tgit update-ref -d refs/heads/other &&\n      +\tgit rev-parse refs/heads/main >actual &&\n      +\ttest_cmp expect actual\n\n-- \ngitgitgadget\n"},{"id":"487092","messageId":"29c32d3e6f7c5dbea53705782a9d4371655afd2d.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 02/12] remove REFFILES prerequisite for some tests in t1405 and t2017","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:50Z","receivedAt":"2024-01-19T20:19:05Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nThese tests are compatible with the reftable backend and thus do not\nneed the REFFILES prerequisite. Even though 53af25e4\n(t1405: mark test that checks existence as REFFILES, 2022-01-31) and\n53af25e4 (t1405: mark test that checks existence as REFFILES,\n2022-01-31) marked these tests to require REFFILES, the reftable backend\nin its current state does indeed work with these tests.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t1405-main-ref-store.sh  | 2 +-\n t/t2017-checkout-orphan.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh\nindex e4627cf1b61..62c1eadb190 100755\n--- a/t/t1405-main-ref-store.sh\n+++ b/t/t1405-main-ref-store.sh\n@@ -112,7 +112,7 @@ test_expect_success 'delete_reflog(HEAD)' '\n \ttest_must_fail git reflog exists HEAD\n '\n \n-test_expect_success REFFILES 'create-reflog(HEAD)' '\n+test_expect_success 'create-reflog(HEAD)' '\n \t$RUN create-reflog HEAD &&\n \tgit reflog exists HEAD\n '\ndiff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh\nindex 947d1587ac8..a5c7358eeab 100755\n--- a/t/t2017-checkout-orphan.sh\n+++ b/t/t2017-checkout-orphan.sh\n@@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' '\n \tgit rev-parse --verify delta@{0}\n '\n \n-test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' '\n+test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '\n \tgit checkout main &&\n \tgit config core.logAllRefUpdates false &&\n \tgit checkout --orphan epsilon &&\n-- \ngitgitgadget\n\n"},{"id":"487093","messageId":"122d19a909536b570d4e1fd28228279616604ece.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 03/12] t1414: convert test to use Git commands instead of writing refs manually","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:51Z","receivedAt":"2024-01-19T20:19:06Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nThis test can be re-written to use Git commands rather than writing a\nmanual ref in the reflog. This way this test no longer needs the\nREFFILES prerequisite.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t1414-reflog-walk.sh | 11 +++++------\n 1 file changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t1414-reflog-walk.sh b/t/t1414-reflog-walk.sh\nindex ea64cecf47b..be6c3f472c1 100755\n--- a/t/t1414-reflog-walk.sh\n+++ b/t/t1414-reflog-walk.sh\n@@ -121,13 +121,12 @@ test_expect_success 'min/max age uses entry date to limit' '\n \n # Create a situation where the reflog and ref database disagree about the latest\n # state of HEAD.\n-test_expect_success REFFILES 'walk prefers reflog to ref tip' '\n+test_expect_success 'walk prefers reflog to ref tip' '\n+\ttest_commit A &&\n+\ttest_commit B &&\n+\tgit reflog delete HEAD@{0} &&\n \thead=$(git rev-parse HEAD) &&\n-\tone=$(git rev-parse one) &&\n-\tident=\"$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\" &&\n-\techo \"$head $one $ident\tbroken reflog entry\" >>.git/logs/HEAD &&\n-\n-\techo $one >expect &&\n+\tgit rev-parse A >expect &&\n \tgit log -g --format=%H -1 >actual &&\n \ttest_cmp expect actual\n '\n-- \ngitgitgadget\n\n"},{"id":"487094","messageId":"42dc9948aa5000e94d63701ef61c9d93a6744b51.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 05/12] t1405: move reffiles specific tests to t0601","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:53Z","receivedAt":"2024-01-19T20:19:07Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test to t0601 with other reffiles specific pack-refs tests\nsince it is reffiles specific in that it looks into the loose refs\ndirectory for an assertion.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0601-reffiles-pack-refs.sh | 8 ++++++++\n t/t1405-main-ref-store.sh     | 8 --------\n 2 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t0601-reffiles-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh\nindex f7a3f693901..2e457c4f2df 100755\n--- a/t/t0601-reffiles-pack-refs.sh\n+++ b/t/t0601-reffiles-pack-refs.sh\n@@ -32,6 +32,14 @@ test_expect_success 'prepare a trivial repository' '\n \tHEAD=$(git rev-parse --verify HEAD)\n '\n \n+test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '\n+\tN=`find .git/refs -type f | wc -l` &&\n+\ttest \"$N\" != 0 &&\n+\ttest-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&\n+\tN=`find .git/refs -type f` &&\n+\ttest -z \"$N\"\n+'\n+\n SHA1=\n \n test_expect_success 'see if git show-ref works as expected' '\ndiff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh\nindex 62c1eadb190..976bd71efb5 100755\n--- a/t/t1405-main-ref-store.sh\n+++ b/t/t1405-main-ref-store.sh\n@@ -15,14 +15,6 @@ test_expect_success 'setup' '\n \ttest_commit one\n '\n \n-test_expect_success REFFILES 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '\n-\tN=`find .git/refs -type f | wc -l` &&\n-\ttest \"$N\" != 0 &&\n-\t$RUN pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&\n-\tN=`find .git/refs -type f` &&\n-\ttest -z \"$N\"\n-'\n-\n test_expect_success 'create_symref(FOO, refs/heads/main)' '\n \t$RUN create-symref FOO refs/heads/main nothing &&\n \techo refs/heads/main >expected &&\n-- \ngitgitgadget\n\n"},{"id":"487095","messageId":"c3f0b81200cb9199de96737745345ad93061a8d0.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 04/12] t1404: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:52Z","receivedAt":"2024-01-19T20:19:07Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nThese tests modify loose refs manually and are specific to the reffiles\nbackend. Move these to t0600 to be part of a test suite of reffiles\nspecific tests.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh  | 263 +++++++++++++++++++++++++++++++++++\n t/t1404-update-ref-errors.sh | 237 -------------------------------\n 2 files changed, 263 insertions(+), 237 deletions(-)\n create mode 100755 t/t0600-reffiles-backend.sh\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nnew file mode 100755\nindex 00000000000..2f910bd76ad\n--- /dev/null\n+++ b/t/t0600-reffiles-backend.sh\n@@ -0,0 +1,263 @@\n+#!/bin/sh\n+\n+test_description='Test reffiles backend'\n+\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+TEST_PASSES_SANITIZE_LEAK=true\n+. ./test-lib.sh\n+\n+if ! test_have_prereq REFFILES\n+\tthen\n+\t\tskip_all='skipping reffiles specific tests'\n+\t\ttest_done\n+fi\n+\n+test_expect_success 'setup' '\n+\tgit commit --allow-empty -m Initial &&\n+\tC=$(git rev-parse HEAD) &&\n+\tgit commit --allow-empty -m Second &&\n+\tD=$(git rev-parse HEAD) &&\n+\tgit commit --allow-empty -m Third &&\n+\tE=$(git rev-parse HEAD)\n+'\n+\n+test_expect_success 'empty directory should not fool rev-parse' '\n+\tprefix=refs/e-rev-parse &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\techo \"$C\" >expected &&\n+\tgit rev-parse $prefix/foo >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'empty directory should not fool for-each-ref' '\n+\tprefix=refs/e-for-each-ref &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit for-each-ref $prefix >expected &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tgit for-each-ref $prefix >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'empty directory should not fool create' '\n+\tprefix=refs/e-create &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"create %s $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool verify' '\n+\tprefix=refs/e-verify &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"verify %s $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 1-arg update' '\n+\tprefix=refs/e-update-1 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"update %s $D\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 2-arg update' '\n+\tprefix=refs/e-update-2 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"update %s $D $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 0-arg delete' '\n+\tprefix=refs/e-delete-0 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"delete %s\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'empty directory should not fool 1-arg delete' '\n+\tprefix=refs/e-delete-1 &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tmkdir -p .git/$prefix/foo/bar/baz &&\n+\tprintf \"delete %s $C\\n\" $prefix/foo |\n+\tgit update-ref --stdin\n+'\n+\n+test_expect_success 'non-empty directory blocks create' '\n+\tprefix=refs/ne-create &&\n+\tmkdir -p .git/$prefix/foo/bar &&\n+\t: >.git/$prefix/foo/bar/baz.lock &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'broken reference blocks create' '\n+\tprefix=refs/broken-create &&\n+\tmkdir -p .git/$prefix &&\n+\techo \"gobbledigook\" >.git/$prefix/foo &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'non-empty directory blocks indirect create' '\n+\tprefix=refs/ne-indirect-create &&\n+\tgit symbolic-ref $prefix/symref $prefix/foo &&\n+\tmkdir -p .git/$prefix/foo/bar &&\n+\t: >.git/$prefix/foo/bar/baz.lock &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'broken reference blocks indirect create' '\n+\tprefix=refs/broken-indirect-create &&\n+\tgit symbolic-ref $prefix/symref $prefix/foo &&\n+\techo \"gobbledigook\" >.git/$prefix/foo &&\n+\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err &&\n+\tcat >expected <<-EOF &&\n+\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n+\tEOF\n+\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n+\ttest_must_fail git update-ref --stdin 2>output.err &&\n+\ttest_cmp expected output.err\n+'\n+\n+test_expect_success 'no bogus intermediate values during delete' '\n+\tprefix=refs/slow-transaction &&\n+\t# Set up a reference with differing loose and packed versions:\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tgit update-ref $prefix/foo $D &&\n+\t# Now try to update the reference, but hold the `packed-refs` lock\n+\t# for a while to see what happens while the process is blocked:\n+\t: >.git/packed-refs.lock &&\n+\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n+\t{\n+\t\t# Note: the following command is intentionally run in the\n+\t\t# background. We increase the timeout so that `update-ref`\n+\t\t# attempts to acquire the `packed-refs` lock for much longer\n+\t\t# than it takes for us to do the check then delete it:\n+\t\tgit -c core.packedrefstimeout=30000 update-ref -d $prefix/foo &\n+\t} &&\n+\tpid2=$! &&\n+\t# Give update-ref plenty of time to get to the point where it tries\n+\t# to lock packed-refs:\n+\tsleep 1 &&\n+\t# Make sure that update-ref did not complete despite the lock:\n+\tkill -0 $pid2 &&\n+\t# Verify that the reference still has its old value:\n+\tsha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) &&\n+\tcase \"$sha1\" in\n+\t$D)\n+\t\t# This is what we hope for; it means that nothing\n+\t\t# user-visible has changed yet.\n+\t\t: ;;\n+\tundefined)\n+\t\t# This is not correct; it means the deletion has happened\n+\t\t# already even though update-ref should not have been\n+\t\t# able to acquire the lock yet.\n+\t\techo \"$prefix/foo deleted prematurely\" &&\n+\t\tbreak\n+\t\t;;\n+\t$C)\n+\t\t# This value should never be seen. Probably the loose\n+\t\t# reference has been deleted but the packed reference\n+\t\t# is still there:\n+\t\techo \"$prefix/foo incorrectly observed to be C\" &&\n+\t\tbreak\n+\t\t;;\n+\t*)\n+\t\t# WTF?\n+\t\techo \"unexpected value observed for $prefix/foo: $sha1\" &&\n+\t\tbreak\n+\t\t;;\n+\tesac >out &&\n+\trm -f .git/packed-refs.lock &&\n+\twait $pid2 &&\n+\ttest_must_be_empty out &&\n+\ttest_must_fail git rev-parse --verify --quiet $prefix/foo\n+'\n+\n+test_expect_success 'delete fails cleanly if packed-refs file is locked' '\n+\tprefix=refs/locked-packed-refs &&\n+\t# Set up a reference with differing loose and packed versions:\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tgit update-ref $prefix/foo $D &&\n+\tgit for-each-ref $prefix >unchanged &&\n+\t# Now try to delete it while the `packed-refs` lock is held:\n+\t: >.git/packed-refs.lock &&\n+\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n+\ttest_must_fail git update-ref -d $prefix/foo >out 2>err &&\n+\tgit for-each-ref $prefix >actual &&\n+\ttest_grep \"Unable to create $SQ.*packed-refs.lock$SQ: \" err &&\n+\ttest_cmp unchanged actual\n+'\n+\n+test_expect_success 'delete fails cleanly if packed-refs.new write fails' '\n+\t# Setup and expectations are similar to the test above.\n+\tprefix=refs/failed-packed-refs &&\n+\tgit update-ref $prefix/foo $C &&\n+\tgit pack-refs --all &&\n+\tgit update-ref $prefix/foo $D &&\n+\tgit for-each-ref $prefix >unchanged &&\n+\t# This should not happen in practice, but it is an easy way to get a\n+\t# reliable error (we open with create_tempfile(), which uses O_EXCL).\n+\t: >.git/packed-refs.new &&\n+\ttest_when_finished \"rm -f .git/packed-refs.new\" &&\n+\ttest_must_fail git update-ref -d $prefix/foo &&\n+\tgit for-each-ref $prefix >actual &&\n+\ttest_cmp unchanged actual\n+'\n+\n+test_done\ndiff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\nindex 0369beea33b..00b70137053 100755\n--- a/t/t1404-update-ref-errors.sh\n+++ b/t/t1404-update-ref-errors.sh\n@@ -191,78 +191,6 @@ test_expect_success 'one new ref is a simple prefix of another' '\n \n '\n \n-test_expect_success REFFILES 'empty directory should not fool rev-parse' '\n-\tprefix=refs/e-rev-parse &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\techo \"$C\" >expected &&\n-\tgit rev-parse $prefix/foo >actual &&\n-\ttest_cmp expected actual\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool for-each-ref' '\n-\tprefix=refs/e-for-each-ref &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit for-each-ref $prefix >expected &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tgit for-each-ref $prefix >actual &&\n-\ttest_cmp expected actual\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool create' '\n-\tprefix=refs/e-create &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"create %s $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool verify' '\n-\tprefix=refs/e-verify &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"verify %s $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 1-arg update' '\n-\tprefix=refs/e-update-1 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"update %s $D\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 2-arg update' '\n-\tprefix=refs/e-update-2 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"update %s $D $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 0-arg delete' '\n-\tprefix=refs/e-delete-0 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"delete %s\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n-test_expect_success REFFILES 'empty directory should not fool 1-arg delete' '\n-\tprefix=refs/e-delete-1 &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tmkdir -p .git/$prefix/foo/bar/baz &&\n-\tprintf \"delete %s $C\\n\" $prefix/foo |\n-\tgit update-ref --stdin\n-'\n-\n test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '\n \tdf_test refs/df-al-ds --add-del foo/bar foo\n '\n@@ -468,169 +396,4 @@ test_expect_success 'incorrect old value blocks indirect no-deref delete' '\n \ttest_cmp expected output.err\n '\n \n-test_expect_success REFFILES 'non-empty directory blocks create' '\n-\tprefix=refs/ne-create &&\n-\tmkdir -p .git/$prefix/foo/bar &&\n-\t: >.git/$prefix/foo/bar/baz.lock &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'broken reference blocks create' '\n-\tprefix=refs/broken-create &&\n-\tmkdir -p .git/$prefix &&\n-\techo \"gobbledigook\" >.git/$prefix/foo &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'non-empty directory blocks indirect create' '\n-\tprefix=refs/ne-indirect-create &&\n-\tgit symbolic-ref $prefix/symref $prefix/foo &&\n-\tmkdir -p .git/$prefix/foo/bar &&\n-\t: >.git/$prefix/foo/bar/baz.lock &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'broken reference blocks indirect create' '\n-\tprefix=refs/broken-indirect-create &&\n-\tgit symbolic-ref $prefix/symref $prefix/foo &&\n-\techo \"gobbledigook\" >.git/$prefix/foo &&\n-\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err &&\n-\tcat >expected <<-EOF &&\n-\tfatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken\n-\tEOF\n-\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n-\ttest_must_fail git update-ref --stdin 2>output.err &&\n-\ttest_cmp expected output.err\n-'\n-\n-test_expect_success REFFILES 'no bogus intermediate values during delete' '\n-\tprefix=refs/slow-transaction &&\n-\t# Set up a reference with differing loose and packed versions:\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tgit update-ref $prefix/foo $D &&\n-\t# Now try to update the reference, but hold the `packed-refs` lock\n-\t# for a while to see what happens while the process is blocked:\n-\t: >.git/packed-refs.lock &&\n-\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n-\t{\n-\t\t# Note: the following command is intentionally run in the\n-\t\t# background. We increase the timeout so that `update-ref`\n-\t\t# attempts to acquire the `packed-refs` lock for much longer\n-\t\t# than it takes for us to do the check then delete it:\n-\t\tgit -c core.packedrefstimeout=30000 update-ref -d $prefix/foo &\n-\t} &&\n-\tpid2=$! &&\n-\t# Give update-ref plenty of time to get to the point where it tries\n-\t# to lock packed-refs:\n-\tsleep 1 &&\n-\t# Make sure that update-ref did not complete despite the lock:\n-\tkill -0 $pid2 &&\n-\t# Verify that the reference still has its old value:\n-\tsha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) &&\n-\tcase \"$sha1\" in\n-\t$D)\n-\t\t# This is what we hope for; it means that nothing\n-\t\t# user-visible has changed yet.\n-\t\t: ;;\n-\tundefined)\n-\t\t# This is not correct; it means the deletion has happened\n-\t\t# already even though update-ref should not have been\n-\t\t# able to acquire the lock yet.\n-\t\techo \"$prefix/foo deleted prematurely\" &&\n-\t\tbreak\n-\t\t;;\n-\t$C)\n-\t\t# This value should never be seen. Probably the loose\n-\t\t# reference has been deleted but the packed reference\n-\t\t# is still there:\n-\t\techo \"$prefix/foo incorrectly observed to be C\" &&\n-\t\tbreak\n-\t\t;;\n-\t*)\n-\t\t# WTF?\n-\t\techo \"unexpected value observed for $prefix/foo: $sha1\" &&\n-\t\tbreak\n-\t\t;;\n-\tesac >out &&\n-\trm -f .git/packed-refs.lock &&\n-\twait $pid2 &&\n-\ttest_must_be_empty out &&\n-\ttest_must_fail git rev-parse --verify --quiet $prefix/foo\n-'\n-\n-test_expect_success REFFILES 'delete fails cleanly if packed-refs file is locked' '\n-\tprefix=refs/locked-packed-refs &&\n-\t# Set up a reference with differing loose and packed versions:\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tgit update-ref $prefix/foo $D &&\n-\tgit for-each-ref $prefix >unchanged &&\n-\t# Now try to delete it while the `packed-refs` lock is held:\n-\t: >.git/packed-refs.lock &&\n-\ttest_when_finished \"rm -f .git/packed-refs.lock\" &&\n-\ttest_must_fail git update-ref -d $prefix/foo >out 2>err &&\n-\tgit for-each-ref $prefix >actual &&\n-\ttest_grep \"Unable to create $SQ.*packed-refs.lock$SQ: \" err &&\n-\ttest_cmp unchanged actual\n-'\n-\n-test_expect_success REFFILES 'delete fails cleanly if packed-refs.new write fails' '\n-\t# Setup and expectations are similar to the test above.\n-\tprefix=refs/failed-packed-refs &&\n-\tgit update-ref $prefix/foo $C &&\n-\tgit pack-refs --all &&\n-\tgit update-ref $prefix/foo $D &&\n-\tgit for-each-ref $prefix >unchanged &&\n-\t# This should not happen in practice, but it is an easy way to get a\n-\t# reliable error (we open with create_tempfile(), which uses O_EXCL).\n-\t: >.git/packed-refs.new &&\n-\ttest_when_finished \"rm -f .git/packed-refs.new\" &&\n-\ttest_must_fail git update-ref -d $prefix/foo &&\n-\tgit for-each-ref $prefix >actual &&\n-\ttest_cmp unchanged actual\n-'\n-\n test_done\n-- \ngitgitgadget\n\n"},{"id":"487096","messageId":"98e40a024b9ae031d72506ff93684ba1e7efb4ae.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 06/12] t1406: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:54Z","receivedAt":"2024-01-19T20:19:08Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test to t0600 with the rest of the tests that are specific to\nreffiles. This test reaches into reflog directories manually, and so are\nspecific to reffiles.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh   | 48 +++++++++++++++++++++++++++++++++++\n t/t1407-worktree-ref-store.sh | 37 ---------------------------\n 2 files changed, 48 insertions(+), 37 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 2f910bd76ad..3bd28699d53 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -260,4 +260,52 @@ test_expect_success 'delete fails cleanly if packed-refs.new write fails' '\n \ttest_cmp unchanged actual\n '\n \n+RWT=\"test-tool ref-store worktree:wt\"\n+RMAIN=\"test-tool ref-store worktree:main\"\n+\n+test_expect_success 'setup worktree' '\n+\ttest_commit first &&\n+\tgit worktree add -b wt-main wt &&\n+\t(\n+\t\tcd wt &&\n+\t\ttest_commit second\n+\t)\n+'\n+\n+# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should\n+# only appear in the for-each-reflog output if it is called from the correct\n+# worktree, which is exercised in this test. This test is poorly written for\n+# mulitple reasons: 1) it creates invalidly formatted log entres. 2) it uses\n+# direct FS access for creating the reflogs. 3) PSEUDO-WT and refs/bisect/random\n+# do not create reflogs by default, so it is not testing a realistic scenario.\n+test_expect_success 'for_each_reflog()' '\n+\techo $ZERO_OID > .git/logs/PSEUDO-MAIN &&\n+\tmkdir -p     .git/logs/refs/bisect &&\n+\techo $ZERO_OID > .git/logs/refs/bisect/random &&\n+\n+\techo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&\n+\tmkdir -p     .git/worktrees/wt/logs/refs/bisect &&\n+\techo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&\n+\n+\t$RWT for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n+\tcat >expected <<-\\EOF &&\n+\tHEAD 0x1\n+\tPSEUDO-WT 0x0\n+\trefs/bisect/wt-random 0x0\n+\trefs/heads/main 0x0\n+\trefs/heads/wt-main 0x0\n+\tEOF\n+\ttest_cmp expected actual &&\n+\n+\t$RMAIN for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n+\tcat >expected <<-\\EOF &&\n+\tHEAD 0x1\n+\tPSEUDO-MAIN 0x0\n+\trefs/bisect/random 0x0\n+\trefs/heads/main 0x0\n+\trefs/heads/wt-main 0x0\n+\tEOF\n+\ttest_cmp expected actual\n+'\n+\n test_done\ndiff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh\nindex 05b1881c591..48b1c92a414 100755\n--- a/t/t1407-worktree-ref-store.sh\n+++ b/t/t1407-worktree-ref-store.sh\n@@ -53,41 +53,4 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' '\n \ttest_cmp expected actual\n '\n \n-# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should\n-# only appear in the for-each-reflog output if it is called from the correct\n-# worktree, which is exercised in this test. This test is poorly written (and\n-# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly\n-# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3)\n-# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is\n-# not testing a realistic scenario.\n-test_expect_success REFFILES 'for_each_reflog()' '\n-\techo $ZERO_OID > .git/logs/PSEUDO-MAIN &&\n-\tmkdir -p     .git/logs/refs/bisect &&\n-\techo $ZERO_OID > .git/logs/refs/bisect/random &&\n-\n-\techo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&\n-\tmkdir -p     .git/worktrees/wt/logs/refs/bisect &&\n-\techo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&\n-\n-\t$RWT for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n-\tcat >expected <<-\\EOF &&\n-\tHEAD 0x1\n-\tPSEUDO-WT 0x0\n-\trefs/bisect/wt-random 0x0\n-\trefs/heads/main 0x0\n-\trefs/heads/wt-main 0x0\n-\tEOF\n-\ttest_cmp expected actual &&\n-\n-\t$RMAIN for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n-\tcat >expected <<-\\EOF &&\n-\tHEAD 0x1\n-\tPSEUDO-MAIN 0x0\n-\trefs/bisect/random 0x0\n-\trefs/heads/main 0x0\n-\trefs/heads/wt-main 0x0\n-\tEOF\n-\ttest_cmp expected actual\n-'\n-\n test_done\n-- \ngitgitgadget\n\n"},{"id":"487097","messageId":"d93c9c410b995b0c72958b1e9edc27c785857c55.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 07/12] t1410: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:55Z","receivedAt":"2024-01-19T20:19:09Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove these tests to t0600 with other reffiles specific tests since they\ndo things like take a lock on an individual ref, and write directly into\nthe reflog refs\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 51 +++++++++++++++++++++++++++++++++++++\n t/t1410-reflog.sh           | 42 ------------------------------\n 2 files changed, 51 insertions(+), 42 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 3bd28699d53..44571033fac 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -308,4 +308,55 @@ test_expect_success 'for_each_reflog()' '\n \ttest_cmp expected actual\n '\n \n+# Triggering the bug detected by this test requires a newline to fall\n+# exactly BUFSIZ-1 bytes from the end of the file. We don't know\n+# what that value is, since it's platform dependent. However, if\n+# we choose some value N, we also catch any D which divides N evenly\n+# (since we will read backwards in chunks of D). So we choose 8K,\n+# which catches glibc (with an 8K BUFSIZ) and *BSD (1K).\n+#\n+# Each line is 114 characters, so we need 75 to still have a few before the\n+# last 8K. The 89-character padding on the final entry lines up our\n+# newline exactly.\n+test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' '\n+\tgit checkout -b reflogskip &&\n+\tzf=$(test_oid zero_2) &&\n+\tident=\"abc <xyz> 0000000001 +0000\" &&\n+\tfor i in $(test_seq 1 75); do\n+\t\tprintf \"$zf%02d $zf%02d %s\\t\" $i $(($i+1)) \"$ident\" &&\n+\t\tif test $i = 75; then\n+\t\t\tfor j in $(test_seq 1 89); do\n+\t\t\t\tprintf X || return 1\n+\t\t\tdone\n+\t\telse\n+\t\t\tprintf X\n+\t\tfi &&\n+\t\tprintf \"\\n\" || return 1\n+\tdone >.git/logs/refs/heads/reflogskip &&\n+\tgit rev-parse reflogskip@{73} >actual &&\n+\techo ${zf}03 >expect &&\n+\ttest_cmp expect actual\n+'\n+\n+# This test takes a lock on an individual ref; this is not supported in\n+# reftable.\n+test_expect_success 'reflog expire operates on symref not referrent' '\n+\tgit branch --create-reflog the_symref &&\n+\tgit branch --create-reflog referrent &&\n+\tgit update-ref referrent HEAD &&\n+\tgit symbolic-ref refs/heads/the_symref refs/heads/referrent &&\n+\ttest_when_finished \"rm -f .git/refs/heads/referrent.lock\" &&\n+\ttouch .git/refs/heads/referrent.lock &&\n+\tgit reflog expire --expire=all the_symref\n+'\n+\n+test_expect_success 'empty reflog' '\n+\ttest_when_finished \"rm -rf empty\" &&\n+\tgit init empty &&\n+\ttest_commit -C empty A &&\n+\t>empty/.git/logs/refs/heads/foo &&\n+\tgit -C empty reflog expire --all 2>err &&\n+\ttest_must_be_empty err\n+'\n+\n test_done\ndiff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh\nindex a0ff8d51f04..d2f5f42e674 100755\n--- a/t/t1410-reflog.sh\n+++ b/t/t1410-reflog.sh\n@@ -354,36 +354,6 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '\n \ttest_must_be_empty actual\n '\n \n-# Triggering the bug detected by this test requires a newline to fall\n-# exactly BUFSIZ-1 bytes from the end of the file. We don't know\n-# what that value is, since it's platform dependent. However, if\n-# we choose some value N, we also catch any D which divides N evenly\n-# (since we will read backwards in chunks of D). So we choose 8K,\n-# which catches glibc (with an 8K BUFSIZ) and *BSD (1K).\n-#\n-# Each line is 114 characters, so we need 75 to still have a few before the\n-# last 8K. The 89-character padding on the final entry lines up our\n-# newline exactly.\n-test_expect_success REFFILES,SHA1 'parsing reverse reflogs at BUFSIZ boundaries' '\n-\tgit checkout -b reflogskip &&\n-\tzf=$(test_oid zero_2) &&\n-\tident=\"abc <xyz> 0000000001 +0000\" &&\n-\tfor i in $(test_seq 1 75); do\n-\t\tprintf \"$zf%02d $zf%02d %s\\t\" $i $(($i+1)) \"$ident\" &&\n-\t\tif test $i = 75; then\n-\t\t\tfor j in $(test_seq 1 89); do\n-\t\t\t\tprintf X || return 1\n-\t\t\tdone\n-\t\telse\n-\t\t\tprintf X\n-\t\tfi &&\n-\t\tprintf \"\\n\" || return 1\n-\tdone >.git/logs/refs/heads/reflogskip &&\n-\tgit rev-parse reflogskip@{73} >actual &&\n-\techo ${zf}03 >expect &&\n-\ttest_cmp expect actual\n-'\n-\n test_expect_success 'no segfaults for reflog containing non-commit sha1s' '\n \tgit update-ref --create-reflog -m \"Creating ref\" \\\n \t\trefs/tests/tree-in-reflog HEAD &&\n@@ -397,18 +367,6 @@ test_expect_failure 'reflog with non-commit entries displays all entries' '\n \ttest_line_count = 3 actual\n '\n \n-# This test takes a lock on an individual ref; this is not supported in\n-# reftable.\n-test_expect_success REFFILES 'reflog expire operates on symref not referrent' '\n-\tgit branch --create-reflog the_symref &&\n-\tgit branch --create-reflog referrent &&\n-\tgit update-ref referrent HEAD &&\n-\tgit symbolic-ref refs/heads/the_symref refs/heads/referrent &&\n-\ttest_when_finished \"rm -f .git/refs/heads/referrent.lock\" &&\n-\ttouch .git/refs/heads/referrent.lock &&\n-\tgit reflog expire --expire=all the_symref\n-'\n-\n test_expect_success 'continue walking past root commits' '\n \tgit init orphanage &&\n \t(\n-- \ngitgitgadget\n\n"},{"id":"487098","messageId":"8327b12a313b00d1ca392f446e13f9c1018f1d84.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 08/12] t1415: move reffiles specific tests to t0601","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:56Z","receivedAt":"2024-01-19T20:19:10Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test into t0601 with other reffiles pack-refs specific tests\nsince it checks for individua loose refs and thus is specific to the\nreffiles backend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0601-reffiles-pack-refs.sh | 20 ++++++++++++++++++++\n t/t1415-worktree-refs.sh      | 11 -----------\n 2 files changed, 20 insertions(+), 11 deletions(-)\n\ndiff --git a/t/t0601-reffiles-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh\nindex 2e457c4f2df..c2c19befacc 100755\n--- a/t/t0601-reffiles-pack-refs.sh\n+++ b/t/t0601-reffiles-pack-refs.sh\n@@ -308,4 +308,24 @@ test_expect_success SYMLINKS 'pack symlinked packed-refs' '\n \ttest \"$(test_readlink .git/packed-refs)\" = \"my-deviant-packed-refs\"\n '\n \n+# The 'packed-refs' file is stored directly in .git/. This means it is global\n+# to the repository, and can only contain refs that are shared across all\n+# worktrees.\n+test_expect_success 'refs/worktree must not be packed' '\n+\ttest_commit initial &&\n+\ttest_commit wt1 &&\n+\ttest_commit wt2 &&\n+\tgit worktree add wt1 wt1 &&\n+\tgit worktree add wt2 wt2 &&\n+\tgit checkout initial &&\n+\tgit update-ref refs/worktree/foo HEAD &&\n+\tgit -C wt1 update-ref refs/worktree/foo HEAD &&\n+\tgit -C wt2 update-ref refs/worktree/foo HEAD &&\n+\tgit pack-refs --all &&\n+\ttest_path_is_missing .git/refs/tags/wt1 &&\n+\ttest_path_is_file .git/refs/worktree/foo &&\n+\ttest_path_is_file .git/worktrees/wt1/refs/worktree/foo &&\n+\ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n+'\n+\n test_done\ndiff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh\nindex 3b531842dd4..eb4eec8becb 100755\n--- a/t/t1415-worktree-refs.sh\n+++ b/t/t1415-worktree-refs.sh\n@@ -17,17 +17,6 @@ test_expect_success 'setup' '\n \tgit -C wt2 update-ref refs/worktree/foo HEAD\n '\n \n-# The 'packed-refs' file is stored directly in .git/. This means it is global\n-# to the repository, and can only contain refs that are shared across all\n-# worktrees.\n-test_expect_success REFFILES 'refs/worktree must not be packed' '\n-\tgit pack-refs --all &&\n-\ttest_path_is_missing .git/refs/tags/wt1 &&\n-\ttest_path_is_file .git/refs/worktree/foo &&\n-\ttest_path_is_file .git/worktrees/wt1/refs/worktree/foo &&\n-\ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n-'\n-\n test_expect_success 'refs/worktree are per-worktree' '\n \ttest_cmp_rev worktree/foo initial &&\n \t( cd wt1 && test_cmp_rev worktree/foo wt1 ) &&\n-- \ngitgitgadget\n\n"},{"id":"487099","messageId":"891a3d057d28bd4283a51fe6eb60f1fe99252bb7.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 09/12] t1503: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:57Z","receivedAt":"2024-01-19T20:19:11Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove this test to t0600 with other reffiles specific tests since it\nchecks for loose refs and is specific to the reffiles backend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 5 +++++\n t/t1503-rev-parse-verify.sh | 5 -----\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 44571033fac..a2ef34eab28 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -359,4 +359,9 @@ test_expect_success 'empty reflog' '\n \ttest_must_be_empty err\n '\n \n+test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n+       ln -s does-not-exist .git/refs/heads/broken &&\n+       test_must_fail git rev-parse --verify broken\n+'\n+\n test_done\ndiff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh\nindex bc136833c10..79df65ec7f6 100755\n--- a/t/t1503-rev-parse-verify.sh\n+++ b/t/t1503-rev-parse-verify.sh\n@@ -144,11 +144,6 @@ test_expect_success 'main@{n} for various n' '\n \ttest_must_fail git rev-parse --verify main@{$Np1}\n '\n \n-test_expect_success SYMLINKS,REFFILES 'ref resolution not confused by broken symlinks' '\n-\tln -s does-not-exist .git/refs/heads/broken &&\n-\ttest_must_fail git rev-parse --verify broken\n-'\n-\n test_expect_success 'options can appear after --verify' '\n \tgit rev-parse --verify HEAD >expect &&\n \tgit rev-parse --verify -q HEAD >actual &&\n-- \ngitgitgadget\n\n"},{"id":"487100","messageId":"bfd5b40317076caa1f09ee9512ceb0c7e2a164e4.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 10/12] t3903: make drop stash test ref backend agnostic","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:58Z","receivedAt":"2024-01-19T20:19:12Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nIn this test, the calls to cut(1) are only used to verify that the\ncontents of the reflog entry look as expected. By replacing these with\ngit-reflog(1) calls, we can make this test ref-backend agnostic.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t3903-stash.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 34faeac3f1c..33192405155 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' '\n \ttest_cmp expect actual\n '\n \n-test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' '\n+test_expect_success 'drop stash reflog updates refs/stash with rewrite' '\n \tgit init repo &&\n \t(\n \t\tcd repo &&\n@@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite'\n \tnew_oid=\"$(git -C repo rev-parse stash@{0})\" &&\n \n \tcat >expect <<-EOF &&\n-\t$(test_oid zero) $old_oid\n-\t$old_oid $new_oid\n+\t$new_oid\n+\t$old_oid\n \tEOF\n-\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n+\tgit -C repo reflog show refs/stash --format=%H >actual &&\n \ttest_cmp expect actual &&\n \n \tgit -C repo stash drop stash@{1} &&\n-\tcut -d\" \" -f1-2 repo/.git/logs/refs/stash >actual &&\n+\tgit -C repo reflog show refs/stash --format=%H >actual &&\n \tcat >expect <<-EOF &&\n-\t$(test_oid zero) $new_oid\n+\t$new_oid\n \tEOF\n \ttest_cmp expect actual\n '\n-- \ngitgitgadget\n\n"},{"id":"487101","messageId":"976be7efc89ae39194b06d12989c30f849854516.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 11/12] t4202: move reffiles specific tests to t0600","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:18:59Z","receivedAt":"2024-01-19T20:19:13Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove two tests into t0600 since they write loose reflog refs manually\nand thus are specific to the reffiles backend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0600-reffiles-backend.sh | 17 +++++++++++++++++\n t/t4202-log.sh              | 17 -----------------\n 2 files changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex a2ef34eab28..17ff60dde77 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -364,4 +364,21 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '\n        test_must_fail git rev-parse --verify broken\n '\n \n+test_expect_success 'log diagnoses bogus HEAD hash' '\n+\tgit init empty &&\n+\ttest_when_finished \"rm -rf empty\" &&\n+\techo 1234abcd >empty/.git/refs/heads/main &&\n+\ttest_must_fail git -C empty log 2>stderr &&\n+\ttest_grep broken stderr\n+'\n+\n+test_expect_success 'log diagnoses bogus HEAD symref' '\n+\tgit init empty &&\n+\ttest-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock &&\n+\ttest_must_fail git -C empty log 2>stderr &&\n+\ttest_grep broken stderr &&\n+\ttest_must_fail git -C empty log --default totally-bogus 2>stderr &&\n+\ttest_grep broken stderr\n+'\n+\n test_done\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex ddd205f98ab..60fe60d7610 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -2255,23 +2255,6 @@ test_expect_success 'log on empty repo fails' '\n \ttest_grep does.not.have.any.commits stderr\n '\n \n-test_expect_success REFFILES 'log diagnoses bogus HEAD hash' '\n-\tgit init empty &&\n-\ttest_when_finished \"rm -rf empty\" &&\n-\techo 1234abcd >empty/.git/refs/heads/main &&\n-\ttest_must_fail git -C empty log 2>stderr &&\n-\ttest_grep broken stderr\n-'\n-\n-test_expect_success REFFILES 'log diagnoses bogus HEAD symref' '\n-\tgit init empty &&\n-\ttest-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock &&\n-\ttest_must_fail git -C empty log 2>stderr &&\n-\ttest_grep broken stderr &&\n-\ttest_must_fail git -C empty log --default totally-bogus 2>stderr &&\n-\ttest_grep broken stderr\n-'\n-\n test_expect_success 'log does not default to HEAD when rev input is given' '\n \tgit log --branches=does-not-exist >actual &&\n \ttest_must_be_empty actual\n-- \ngitgitgadget\n\n"},{"id":"487102","messageId":"7329e87148a7f8d4f8bd1b0fd3a0b1e0bc9e9e69.1705695540.git.gitgitgadget@gmail.com","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"[PATCH v2 12/12] t5312: move reffiles specific tests to t0601","fromName":"John Cai via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-01-19T20:19:00Z","receivedAt":"2024-01-19T20:19:13Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"From: John Cai <johncai86@gmail.com>\n\nMove a few tests into t0601 since they specifically test the packed-refs\nfile and thus are specific to the reffiles backend.\n\nSigned-off-by: John Cai <johncai86@gmail.com>\n---\n t/t0601-reffiles-pack-refs.sh | 30 ++++++++++++++++++++++++++++++\n t/t5312-prune-corruption.sh   | 26 --------------------------\n 2 files changed, 30 insertions(+), 26 deletions(-)\n\ndiff --git a/t/t0601-reffiles-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh\nindex c2c19befacc..263e99cd84b 100755\n--- a/t/t0601-reffiles-pack-refs.sh\n+++ b/t/t0601-reffiles-pack-refs.sh\n@@ -328,4 +328,34 @@ test_expect_success 'refs/worktree must not be packed' '\n \ttest_path_is_file .git/worktrees/wt2/refs/worktree/foo\n '\n \n+# we do not want to count on running pack-refs to\n+# actually pack it, as it is perfectly reasonable to\n+# skip processing a broken ref\n+test_expect_success 'create packed-refs file with broken ref' '\n+\ttest_tick && git commit --allow-empty -m one &&\n+\trecoverable=$(git rev-parse HEAD) &&\n+\ttest_tick && git commit --allow-empty -m two &&\n+\tmissing=$(git rev-parse HEAD) &&\n+\trm -f .git/refs/heads/main &&\n+\tcat >.git/packed-refs <<-EOF &&\n+\t$missing refs/heads/main\n+\t$recoverable refs/heads/other\n+\tEOF\n+\techo $missing >expect &&\n+\tgit rev-parse refs/heads/main >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'pack-refs does not silently delete broken packed ref' '\n+\tgit pack-refs --all --prune &&\n+\tgit rev-parse refs/heads/main >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'pack-refs does not drop broken refs during deletion' '\n+\tgit update-ref -d refs/heads/other &&\n+\tgit rev-parse refs/heads/main >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\ndiff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh\nindex 230cb387122..d8d2e304687 100755\n--- a/t/t5312-prune-corruption.sh\n+++ b/t/t5312-prune-corruption.sh\n@@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '\n \ttest_cmp expect actual\n '\n \n-# we do not want to count on running pack-refs to\n-# actually pack it, as it is perfectly reasonable to\n-# skip processing a broken ref\n-test_expect_success REFFILES 'create packed-refs file with broken ref' '\n-\trm -f .git/refs/heads/main &&\n-\tcat >.git/packed-refs <<-EOF &&\n-\t$missing refs/heads/main\n-\t$recoverable refs/heads/other\n-\tEOF\n-\techo $missing >expect &&\n-\tgit rev-parse refs/heads/main >actual &&\n-\ttest_cmp expect actual\n-'\n-\n-test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' '\n-\tgit pack-refs --all --prune &&\n-\tgit rev-parse refs/heads/main >actual &&\n-\ttest_cmp expect actual\n-'\n-\n-test_expect_success REFFILES  'pack-refs does not drop broken refs during deletion' '\n-\tgit update-ref -d refs/heads/other &&\n-\tgit rev-parse refs/heads/main >actual &&\n-\ttest_cmp expect actual\n-'\n-\n test_done\n-- \ngitgitgadget\n"},{"id":"487197","messageId":"Za5R-5fhhFYqxt-U@tanuki","threadId":"60756","inReplyTo":"ca65b9e6122d10a7b43d06a6069dae00e645a392.1705695540.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 01/12] t3210: move to t0601","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-22T11:31:07Z","receivedAt":"2024-01-22T11:31:13Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Jan 19, 2024 at 08:18:49PM +0000, John Cai via GitGitGadget wrote:\n> From: John Cai <johncai86@gmail.com>\n> \n> Move t3210 to t0601, since these tests are reffiles specific in that\n> they modify loose refs manually. This is part of the effort to\n> categorize these tests together based on the ref backend they test. When\n> we upstream the reftable backend, we can add more tests to t06xx. This\n> way, all tests that test specific ref backend behavior will be grouped\n> together.\n> \n> Signed-off-by: John Cai <johncai86@gmail.com>\n> ---\n>  t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} | 6 ++++++\n>  1 file changed, 6 insertions(+)\n>  rename t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} (98%)\n> \n> diff --git a/t/t3210-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh\n> similarity index 98%\n> rename from t/t3210-pack-refs.sh\n> rename to t/t0601-reffiles-pack-refs.sh\n> index 7f4e98db7db..f7a3f693901 100755\n> --- a/t/t3210-pack-refs.sh\n> +++ b/t/t0601-reffiles-pack-refs.sh\n> @@ -15,6 +15,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n>  TEST_PASSES_SANITIZE_LEAK=true\n>  . ./test-lib.sh\n>  \n> +if ! test_have_prereq REFFILES\n> +\tthen\n> +\t\tskip_all='skipping reffiles specific tests'\n> +\t\ttest_done\n> +fi\n\nIndentation here is off as we do not typically ident the `then`. So this\nshould rather look like the following:\n\nif ! test_have_prereq REFFILES\nthen\n\tskip_all='skipping reffiles specific tests'\n\ttest_done\nfi\n\nPatrick\n"},{"id":"487198","messageId":"Za5SAovUdWCdsNaN@tanuki","threadId":"60756","inReplyTo":"c3f0b81200cb9199de96737745345ad93061a8d0.1705695540.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 04/12] t1404: move reffiles specific tests to t0600","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-22T11:31:14Z","receivedAt":"2024-01-22T11:31:18Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Jan 19, 2024 at 08:18:52PM +0000, John Cai via GitGitGadget wrote:\n> From: John Cai <johncai86@gmail.com>\n> \n> These tests modify loose refs manually and are specific to the reffiles\n> backend. Move these to t0600 to be part of a test suite of reffiles\n> specific tests.\n> \n> Signed-off-by: John Cai <johncai86@gmail.com>\n> ---\n>  t/t0600-reffiles-backend.sh  | 263 +++++++++++++++++++++++++++++++++++\n>  t/t1404-update-ref-errors.sh | 237 -------------------------------\n>  2 files changed, 263 insertions(+), 237 deletions(-)\n>  create mode 100755 t/t0600-reffiles-backend.sh\n> \n> diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\n> new file mode 100755\n> index 00000000000..2f910bd76ad\n> --- /dev/null\n> +++ b/t/t0600-reffiles-backend.sh\n> @@ -0,0 +1,263 @@\n> +#!/bin/sh\n> +\n> +test_description='Test reffiles backend'\n> +\n> +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n> +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n> +\n> +TEST_PASSES_SANITIZE_LEAK=true\n> +. ./test-lib.sh\n> +\n> +if ! test_have_prereq REFFILES\n> +\tthen\n> +\t\tskip_all='skipping reffiles specific tests'\n> +\t\ttest_done\n> +fi\n\nSame issue here, indentation is off.\n\nPatrick\n"},{"id":"487199","messageId":"Za5TW-q4cKS8pNNc@tanuki","threadId":"60756","inReplyTo":"pull.1647.v2.git.git.1705695540.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 00/12] Group reffiles tests","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-01-22T11:36:59Z","receivedAt":"2024-01-22T11:37:05Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Jan 19, 2024 at 08:18:48PM +0000, John Cai via GitGitGadget wrote:\n> This series groups REFFILES specific tests together. These tests are\n> currently grouped together across the test suite based on functionality.\n> However, since they exercise low-level behavior specific to the refs backend\n> being used (in these cases, the ref-files backend), group them together\n> based on which refs backend they test. This way, in the near future when the\n> reftables backend gets upstreamed we can add tests that exercise the\n> reftables backend close by in the t06xx area.\n> \n> These patches also remove the REFFILES prerequisite, since all the tests in\n> t06xx are reffiles specific. In the near future, once the reftable backend\n> is upstreamed, all the tests in t06xx will be forced to run with the\n> reffiles backend.\n> \n> Changes since V1:\n> \n>  * Moved some pack-refs tests to t0601 instead of t0600\n>  * Clarified some commit messages\n>  * Converted a test to be refs-backend agnostic\n>  * Other minor rearranging of tests\n\nI've got two minor nits, but other than that this looks good to me. I've\nalso verified that all tests continue to pass with the current version\nof the reftable backend.\n\nThere's a minor merge conflict with db4192c364 (t: mark tests regarding\ngit-pack-refs(1) to be backend specific, 2024-01-10). This conflict\ncomes from the fact that both patch series add the REFFILES prereq to\nt3210, semantically the changes are the same. So it doesn't quite matter\nwhich of both versions we retain as they both do the same.\n\nPatrick\n"},{"id":"487203","messageId":"CAOLa=ZRS4TLVVYhVxkjmtFyQQNWb=qXGMW_dQC2HUBq+eErFUw@mail.gmail.com","threadId":"60756","inReplyTo":"d93c9c410b995b0c72958b1e9edc27c785857c55.1705695540.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 07/12] t1410: move reffiles specific tests to t0600","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2024-01-22T14:12:29Z","receivedAt":"2024-01-22T14:12:31Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: John Cai <johncai86@gmail.com>\n>\n> Move these tests to t0600 with other reffiles specific tests since they\n> do things like take a lock on an individual ref, and write directly into\n> the reflog refs\n>\n\nNit: missing period.\n"},{"id":"487204","messageId":"CAOLa=ZQNptk28z_SG6BT0bvS_mepF+5dTGizCF1TBa4YBPHUhA@mail.gmail.com","threadId":"60756","inReplyTo":"8327b12a313b00d1ca392f446e13f9c1018f1d84.1705695540.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 08/12] t1415: move reffiles specific tests to t0601","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2024-01-22T14:12:59Z","receivedAt":"2024-01-22T14:13:01Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\"John Cai via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: John Cai <johncai86@gmail.com>\n>\n> Move this test into t0601 with other reffiles pack-refs specific tests\n> since it checks for individua loose refs and thus is specific to the\n\nNit: s/individua/individual\n"},{"id":"487237","messageId":"xmqqplxsrk8n.fsf@gitster.g","threadId":"60756","inReplyTo":"Za5TW-q4cKS8pNNc@tanuki","subject":"Re: [PATCH v2 00/12] Group reffiles tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-23T00:01:12Z","receivedAt":"2024-01-23T00:01:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> I've got two minor nits, but other than that this looks good to me. I've\n> also verified that all tests continue to pass with the current version\n> of the reftable backend.\n\nOK.  I've squashed all the nits from you and Karthik into the copy\nin my tree.  If there is nothing else, let's declare a victory and\nmerge the topic down to 'next' soonish.\n\n> There's a minor merge conflict with db4192c364 (t: mark tests regarding\n> git-pack-refs(1) to be backend specific, 2024-01-10). This conflict\n> comes from the fact that both patch series add the REFFILES prereq to\n> t3210, semantically the changes are the same. So it doesn't quite matter\n> which of both versions we retain as they both do the same.\n\nYup, that is what I've been resolving them.\n\nThanks.\n"},{"id":"487355","messageId":"76D54E67-543E-4093-8D1F-3D5E208FE683@gmail.com","threadId":"60756","inReplyTo":"xmqqplxsrk8n.fsf@gitster.g","subject":"Re: [PATCH v2 00/12] Group reffiles tests","fromName":"John Cai","fromEmail":"johncai86@gmail.com","sentAt":"2024-01-24T21:37:02Z","receivedAt":"2024-01-24T21:37:04Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"Hi Junio,\n\nOn 22 Jan 2024, at 19:01, Junio C Hamano wrote:\n\n> Patrick Steinhardt <ps@pks.im> writes:\n>\n>> I've got two minor nits, but other than that this looks good to me. I've\n>> also verified that all tests continue to pass with the current version\n>> of the reftable backend.\n>\n> OK.  I've squashed all the nits from you and Karthik into the copy\n> in my tree.  If there is nothing else, let's declare a victory and\n> merge the topic down to 'next' soonish.\n\nThank you for doing these tedious corrections!\n>\n>> There's a minor merge conflict with db4192c364 (t: mark tests regarding\n>> git-pack-refs(1) to be backend specific, 2024-01-10). This conflict\n>> comes from the fact that both patch series add the REFFILES prereq to\n>> t3210, semantically the changes are the same. So it doesn't quite matter\n>> which of both versions we retain as they both do the same.\n>\n> Yup, that is what I've been resolving them.\n>\n> Thanks.\n\nthanks\nJohn\n"}]}