{"thread":{"id":"66819","subject":"[PATCH 00/20] t9300: group and move tests to other files","startedAt":"2026-11-10T11:49:45Z","lastAt":"2026-11-12T17:34:20Z","messageCount":45,"participants":["Karthik Nayak","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":20},"messages":[{"id":"558054","messageId":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":null,"subject":"[PATCH 00/20] t9300: group and move tests to other files","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:45Z","receivedAt":"2026-11-10T11:49:45Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"While reading the git-fast-import(1) code, I stumbled upon t9300. The\ntest file is around 4000 LoC and each test has some dependency on the\nstate setup by previous tests.\n\nThis long series unwinds some of these tests and moves them into\nnew/existing tests based on what they exercise. This leaves t9300 in a\nbetter state. I think we can do more here, but I decided to stop before\nthis series got even longer. Based on the reception of this series, I\nwill follow up with more cleanups.\n\nAlso, we could squash some of the commits together. But I found them\neasier to read through this way.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\nKarthik Nayak (20):\n      t9300: move 'fastimport.unpackLimit' to the required test\n      t9300: make the series B tests self-contained\n      t9300: make the series T tests self-contained\n      t9300: make the series S tests self-contained\n      t9300: make the series V tests self-contained\n      t9300: make the series Q tests self-contained\n      t9300: make the series P tests self-contained\n      t9300: make the series O tests self-contained\n      t9300: make the big blob tests self-contained\n      t9300: make the ref update tests self-contained\n      t9300: make the date format tests self-contained\n      t9300: make the pack edges test self-contained\n      t9300: make the marks tests self-contained\n      t9300: make the series Y tests self-contained\n      t9300: make the cat-blob tests self-contained\n      t9300: make the feature and option tests self-contained\n      t9300: make the stream tests self-contained\n      t9300: make the get-mark and encoding tests self-contained\n      t9300: move self-contained tests into dedicated files\n      t93xx: drop the series letter from the moved test names\n\n t/meson.build                     |    5 +\n t/t9300-fast-import.sh            | 2780 +------------------------------------\n t/t9301-fast-import-notes.sh      |  411 ++++++\n t/t9304-fast-import-marks.sh      |  393 ++++++\n t/t9307-fast-import-validation.sh | 1193 ++++++++++++++++\n t/t9308-fast-import-stream.sh     |  822 +++++++++++\n t/t9309-fast-import-checkpoint.sh |  188 +++\n t/t9310-fast-import-submodule.sh  |  341 +++++\n t/t9311-fast-import-refs.sh       |  194 +++\n 9 files changed, 3548 insertions(+), 2779 deletions(-)\n\n\n---\nbase-commit: 8d1b215c01512b9658d4525c54ff9b9245f9a7e8\nchange-id: 20261102-kn-fast-import-tests-1-03de57101c3b\n\n\nThanks\n- Karthik\n\n\n"},{"id":"558055","messageId":"20261110-kn-fast-import-tests-1-v1-1-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 01/20] t9300: move 'fastimport.unpackLimit' to the required test","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:46Z","receivedAt":"2026-11-10T11:49:46Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'empty stream succeeds' test sets 'fastimport.unpackLimit' to '0',\nso that the following imports write packs for the 'verify pack' tests\nto check. The test itself doesn't need it. A following commit makes it\nrun in its own repository, where the setting would no longer reach the\ntests after it.\n\nMove the configuration to 'A: create pack from stdin', the first test\nwhich needs it. The configuration must persist for the 'verify pack'\ntests of the following series, so set it with 'git config' and not with\n'test_config'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 73c6e3d448..fb23492202 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -38,7 +38,6 @@ echo \"$@\"'\n ###\n \n test_expect_success 'empty stream succeeds' '\n-\tgit config fastimport.unpackLimit 0 &&\n \tgit fast-import </dev/null\n '\n \n@@ -47,6 +46,7 @@ test_expect_success 'truncated stream complains' '\n '\n \n test_expect_success 'A: create pack from stdin' '\n+\tgit config fastimport.unpackLimit 0 &&\n \ttest_tick &&\n \tcat >input <<-INPUT_END &&\n \tblob\n\n-- \n2.56.GIT\n\n\n"},{"id":"558056","messageId":"20261110-kn-fast-import-tests-1-v1-2-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 02/20] t9300: make the series B tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:47Z","receivedAt":"2026-11-10T11:49:47Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 't/t9300-fast-import.sh' test file contains numerous tests and is\ncurrently just shy of 4000 lines. This is because the file contains\ntests over multiple series, each series testing particular functionality\nor sections of 'git-fast-import(1)'. In upcoming commits, we want to\nsplit out these tests into individual files for better discoverability.\n\nFirst, we need to remove the dependency tests have on preceding tests.\nModify the tests in 'series B' to each run in a new repository, which is\nremoved when the test completes, so that they neither depend on nor\nleave behind any state.\n\nThe 'B: fail on invalid blob sha1' and 'B: accept branch name\n\"TEMP_TAG\"' tests import on top of 'main', which used to exist from\nearlier tests. Create it with 'test_commit', so that the first import\ncan only fail because of the invalid blob ID.\n\nThe 'fsck' tests require the whole repository to be free of unreachable\nobjects. They only passed because of the garbage collection in the\ncleanup of other tests. A new repository makes that unnecessary.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 472 ++++++++++++++++++++++++++++---------------------\n 1 file changed, 275 insertions(+), 197 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex fb23492202..1b34f6491c 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -358,274 +358,352 @@ test_expect_success 'A: export marks with large values' '\n ###\n \n test_expect_success 'B: fail on invalid blob sha1' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tmark :1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcorrupt\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit base &&\n \n-\tfrom refs/heads/main\n-\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/branch\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/main\n+\t\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n \n-\ttest_when_finished \"rm -f .git/objects/pack_* .git/objects/index_*\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit TEMP_TAG\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\ttag base\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit new &&\n \n-\tfrom refs/heads/main\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit TEMP_TAG\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttag base\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/main\n \n-\ttest_when_finished \"rm -f .git/TEMP_TAG && git gc --prune=now\" &&\n-\tgit fast-import <input &&\n-\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n-\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n+\t\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n+\t)\n '\n \n test_expect_success 'B: accept empty committer' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/empty-committer-1\n-\tcommitter  <> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-1\n+\t\tcommitter  <> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n \n-\ttest_when_finished \"git update-ref -d refs/heads/empty-committer-1\n-\t\tgit gc --prune=now\" &&\n-\tgit fast-import <input &&\n-\tout=$(git fsck) &&\n-\techo \"$out\" &&\n-\ttest -z \"$out\"\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n '\n \n test_expect_success 'B: reject invalid timezone' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-timezone\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-timezone\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: accept invalid timezone with raw-permissive' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-timezone\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit init invalid-timezone &&\n-\tgit -C invalid-timezone fast-import --date-format=raw-permissive <input &&\n-\tgit -C invalid-timezone cat-file -p invalid-timezone >out &&\n-\ttest_grep \"1234567890 [+]051800\" out\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import --date-format=raw-permissive <input &&\n+\t\tgit cat-file -p invalid-timezone >out &&\n+\t\ttest_grep \"1234567890 [+]051800\" out\n+\t)\n '\n \n test_expect_success 'B: accept and fixup committer with no name' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/empty-committer-2\n-\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-2\n+\t\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n \n-\ttest_when_finished \"git update-ref -d refs/heads/empty-committer-2\n-\t\tgit gc --prune=now\" &&\n-\tgit fast-import <input &&\n-\tout=$(git fsck) &&\n-\techo \"$out\" &&\n-\ttest -z \"$out\"\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (1)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (2)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (3)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name <email>> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email>> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (4)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name <email $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (5)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name<email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name<email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of ..' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 100644 :1 ../invalid-path\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 ../invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of .' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tGood path\n-\tCOMMIT\n-\tM 100644 :1 ok-path\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tBad path\n-\tCOMMIT\n-\tR ok-path ./invalid-path\n-\tINPUT_END\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tGood path\n+\t\tCOMMIT\n+\t\tM 100644 :1 ok-path\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tBad path\n+\t\tCOMMIT\n+\t\tR ok-path ./invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 100644 :1 C:/invalid-path\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 C:/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of .git' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 100644 :1 .git/invalid-path\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 .git/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of .gitmodules' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 120000 :1 .gitmodules\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 120000 :1 .gitmodules\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558057","messageId":"20261110-kn-fast-import-tests-1-v1-3-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 03/20] t9300: make the series T tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:48Z","receivedAt":"2026-11-10T11:49:48Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commit, modify the tests in 'series T' to make\nthem independent of state from preceding tests.\n\nThe 'ls root' tests list the root tree of the 'S' branch, using the\nmarks left behind by series S. The expected output is derived from the\ncommit itself, so any commit will do. Run them against a commit created\nin a new repository instead. Run the branch tests in a new repository\ntoo.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 62 +++++++++++++++++++++++++++++++++-----------------\n 1 file changed, 41 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 1b34f6491c..76cc9504eb 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3525,38 +3525,58 @@ test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n ###\n ### series T (ls)\n ###\n-# Setup is carried over from series S.\n \n for root in '\"\"' ''\n do\n \ttest_expect_success \"T: ls root ($root) tree\" '\n-\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n-\t\t040000 tree $(git rev-parse S^{tree})\tZ\n-\t\tEOF\n-\t\tsha1=$(git rev-parse --verify S) &&\n-\t\tgit fast-import --import-marks=marks <<-EOF >actual &&\n-\t\tls $sha1 $root\n-\t\tEOF\n-\t\ttest_cmp expect actual\n+\t\ttest_when_finished \"rm -rf repo\" &&\n+\t\tgit init repo &&\n+\t\t(\n+\t\t\tcd repo &&\n+\t\t\ttest_commit one &&\n+\n+\t\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n+\t\t\t040000 tree $(git rev-parse HEAD^{tree})\tZ\n+\t\t\tEOF\n+\t\t\tsha1=$(git rev-parse --verify HEAD) &&\n+\t\t\tgit fast-import <<-EOF >actual &&\n+\t\t\tls $sha1 $root\n+\t\t\tEOF\n+\t\t\ttest_cmp expect actual\n+\t\t)\n \t'\n done\n \n test_expect_success 'T: delete branch' '\n-\tgit branch to-delete &&\n-\tgit fast-import <<-EOF &&\n-\treset refs/heads/to-delete\n-\tfrom $ZERO_OID\n-\tEOF\n-\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/to-delete\n+\t\tfrom $ZERO_OID\n+\t\tEOF\n+\t\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n+\t)\n '\n \n test_expect_success 'T: empty reset doesnt delete branch' '\n-\tgit branch not-to-delete &&\n-\tgit fast-import <<-EOF &&\n-\treset refs/heads/not-to-delete\n-\tEOF\n-\tgit show-ref &&\n-\tgit rev-parse --verify refs/heads/not-to-delete\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch not-to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/not-to-delete\n+\t\tEOF\n+\t\tgit show-ref &&\n+\t\tgit rev-parse --verify refs/heads/not-to-delete\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558058","messageId":"20261110-kn-fast-import-tests-1-v1-4-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 04/20] t9300: make the series S tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:49Z","receivedAt":"2026-11-10T11:49:49Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series S' to make\nthem independent of state from previous tests.\n\nReplace the 'S: initialize for S tests' test with a\n'setup_marks_repo()' function, so each test can invoke it to setup its\nown repo and tear it down when the test completes.\n\n'S: from with garbage after mark must fail' used to create the 'S2'\ncommit which 'S: merge with garbage after mark must fail' needs. Create\nthat commit in the merge test instead.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 332 +++++++++++++++++++++++++++++--------------------\n 1 file changed, 198 insertions(+), 134 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 76cc9504eb..14af91cffd 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3023,10 +3023,12 @@ test_expect_success 'R: blob appears only once' '\n #\n #   invalid dataref ..\n #\n-test_expect_success 'S: initialize for S tests' '\n+setup_marks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \ttest_tick &&\n \n-\tcat >input <<-INPUT_END &&\n+\tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/S\n \tmark :301\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n@@ -3063,142 +3065,168 @@ test_expect_success 'S: initialize for S tests' '\n \tBLOB\n \tINPUT_END\n \n-\tgit fast-import --export-marks=marks <input\n-'\n+\tgit -C repo fast-import --export-marks=marks <repo/input\n+}\n \n #\n # filemodify, three datarefs\n #\n test_expect_success 'S: filemodify with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit N\n-\tCOMMIT\n-\tM 100644 :403x hello.c\n-\tEOF\n-\ttest_grep \"space after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 :403x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n '\n \n # inline is misspelled; fast-import thinks it is some unknown dataref\n test_expect_success 'S: filemodify with garbage after inline must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit N\n-\tCOMMIT\n-\tM 100644 inlineX hello.c\n-\tdata <<BLOB\n-\tinline\n-\tBLOB\n-\tEOF\n-\ttest_grep \"nvalid dataref\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 inlineX hello.c\n+\t\tdata <<BLOB\n+\t\tinline\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n '\n \n test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n-\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit N\n-\tCOMMIT\n-\tM 100644 ${sha1}x hello.c\n-\tEOF\n-\ttest_grep \"space after SHA1\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n '\n \n #\n # notemodify, three ways to say dataref\n #\n test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note dataref markref\n-\tCOMMIT\n-\tN :202x :302\n-\tEOF\n-\ttest_grep \"space after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref markref\n+\t\tCOMMIT\n+\t\tN :202x :302\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n '\n \n test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note dataref inline\n-\tCOMMIT\n-\tN inlineX :302\n-\tdata <<BLOB\n-\tnote blob\n-\tBLOB\n-\tEOF\n-\ttest_grep \"nvalid dataref\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref inline\n+\t\tCOMMIT\n+\t\tN inlineX :302\n+\t\tdata <<BLOB\n+\t\tnote blob\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n '\n \n test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n-\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note dataref sha1\n-\tCOMMIT\n-\tN ${sha1}x :302\n-\tEOF\n-\ttest_grep \"space after SHA1\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref sha1\n+\t\tCOMMIT\n+\t\tN ${sha1}x :302\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n '\n \n #\n # notemodify, mark in commit-ish\n #\n test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/Snotes\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note commit-ish\n-\tCOMMIT\n-\tN :202 :302x\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/Snotes\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note commit-ish\n+\t\tCOMMIT\n+\t\tN :202 :302x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # from\n #\n test_expect_success 'S: from with garbage after mark must fail' '\n-\ttest_must_fail \\\n-\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S2\n-\tmark :303\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 3\n-\tCOMMIT\n-\tfrom :301x\n-\tM 100644 :403 hello.c\n-\tEOF\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n \n+\t\ttest_must_fail \\\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n \n-\t# go create the commit, need it for merge test\n-\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n-\tcommit refs/heads/S2\n-\tmark :303\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 3\n-\tCOMMIT\n-\tfrom :301\n-\tM 100644 :403 hello.c\n-\tEOF\n-\n-\t# now evaluate the error\n-\ttest_grep \"after mark\" err\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n \n@@ -3206,61 +3234,97 @@ test_expect_success 'S: from with garbage after mark must fail' '\n # merge\n #\n test_expect_success 'S: merge with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tmark :304\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tmerge 4\n-\tCOMMIT\n-\tfrom :302\n-\tmerge :303x\n-\tM 100644 :403 hello.c\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tmark :304\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tmerge 4\n+\t\tCOMMIT\n+\t\tfrom :302\n+\t\tmerge :303x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # tag, from markref\n #\n test_expect_success 'S: tag with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\ttag refs/tags/Stag\n-\tfrom :302x\n-\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<TAG\n-\ttag S\n-\tTAG\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\ttag refs/tags/Stag\n+\t\tfrom :302x\n+\t\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<TAG\n+\t\ttag S\n+\t\tTAG\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # cat-blob markref\n #\n test_expect_success 'S: cat-blob with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcat-blob :403x\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcat-blob :403x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # ls markref\n #\n test_expect_success 'S: ls with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tls :302x hello.c\n-\tEOF\n-\ttest_grep \"space after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls :302x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n '\n \n test_expect_success 'S: ls with garbage after sha1 must fail' '\n-\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tls ${sha1}x hello.c\n-\tEOF\n-\ttest_grep \"space after tree-ish\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after tree-ish\" err\n+\t)\n '\n \n #\n\n-- \n2.56.GIT\n\n\n"},{"id":"558059","messageId":"20261110-kn-fast-import-tests-1-v1-5-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 05/20] t9300: make the series V tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:50Z","receivedAt":"2026-11-10T11:49:50Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series V' to make\nthem independent of state from previous tests.\n\nMove the setup to a 'setup_checkpoint_repo()' function, so each test can\ninvoke it. The tests used to build on the 'U' branch from series U, so\nlet the function create a 'base' commit instead. For the same reason,\nthe tag test now tags 'base' and not 'V'.\n\n'background_import_then_checkpoint()' registers a cleanup with\n'test_when_finished', which is not allowed in a subshell, so call it\nfrom the main shell.\n\nThe 'no new objects' test needs the 'V' commit in a pack, because\nfast-import only detects duplicates against packs and not against loose\nobjects. It used to rely on the 'fastimport.unpackLimit' set by an\nearlier test, so create the commit in the test with\n'fastimport.unpackLimit' set to 0.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 80 ++++++++++++++++++++++++++++++++++----------------\n 1 file changed, 55 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 14af91cffd..8124983409 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3777,7 +3777,7 @@ background_import_then_checkpoint () {\n \trm V.output\n \n \t(\n-\t\tgit fast-import $options <&8 >&9 &\n+\t\tgit -C repo fast-import $options <&8 >&9 &\n \t\techo $! >&9\n \t\twait $!\n \t\techo >&2 \"background fast-import terminated too early with exit code $?\"\n@@ -3829,80 +3829,110 @@ background_import_still_running () {\n \tfi\n }\n \n+setup_checkpoint_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_tick &&\n+\tgit -C repo fast-import <<-INPUT_END\n+\tcommit refs/heads/base\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tbase commit\n+\tCOMMIT\n+\tINPUT_END\n+}\n+\n test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n \tprogress foo\n \tprogress bar\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"\" input &&\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n \tbackground_import_still_running\n '\n \n test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n-\tcat >input <<-\\INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-\\INPUT_END &&\n \treset refs/heads/V\n-\tfrom refs/heads/U\n+\tfrom refs/heads/base\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"\" input &&\n-\ttest \"$(git rev-parse --verify V)\" = \"$(git rev-parse --verify U)\" &&\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\ttest \"$(git -C repo rev-parse --verify V)\" = \"$(git -C repo rev-parse --verify base)\" &&\n \tbackground_import_still_running\n '\n \n test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/V\n \tmark :1\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata 0\n-\tfrom refs/heads/U\n+\tfrom refs/heads/base\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" input &&\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n \n-\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n-\n-\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify U)\" &&\n-\ttest_cmp marks.expected marks.actual &&\n+\t\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify base)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n \tbackground_import_still_running\n '\n \n # Re-create the exact same commit, but on a different branch: no new object is\n # created in the database, but the refs and marks still need to be updated.\n test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n+\tcommit refs/heads/V\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/V2\n \tmark :2\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata 0\n-\tfrom refs/heads/U\n+\tfrom refs/heads/base\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" input &&\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n \n-\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n-\n-\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n-\ttest_cmp marks.expected marks.actual &&\n+\t\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n \tbackground_import_still_running\n '\n \n test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n \ttag Vtag\n-\tfrom refs/heads/V\n+\tfrom refs/heads/base\n \ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata 0\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"\" input &&\n-\tgit show-ref -d Vtag &&\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\tgit -C repo show-ref -d Vtag &&\n \tbackground_import_still_running\n '\n \n\n-- \n2.56.GIT\n\n\n"},{"id":"558060","messageId":"20261110-kn-fast-import-tests-1-v1-6-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 06/20] t9300: make the series Q tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:51Z","receivedAt":"2026-11-10T11:49:51Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series Q' to make\nthem independent of state from previous tests.\n\nThe 'Q: verify' tests inspect the commits and notes written by 'Q:\ncommit notes', and use shell variables set by the preceding tests.\nReplace 'Q: commit notes' with a 'setup_notes_repo()' function, which\ncreates a new repository, runs the import and sets those variables, so\neach test can invoke it. Run the import with 'fastimport.unpackLimit'\nset to 0, so that a pack is written for 'Q: verify pack' to check.\n\nAlso stop using the 'verify_packs()' function, to make it easier to move\nthese tests to another file.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 344 +++++++++++++++++++++++++++++++------------------\n 1 file changed, 220 insertions(+), 124 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 8124983409..9b1827bae2 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2023,7 +2023,17 @@ test_expect_success 'P: fail on blob mark in gitlink' '\n ### series Q (notes)\n ###\n \n-test_expect_success 'Q: commit notes' '\n+setup_notes_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tfile2_data=\"file2\n+second line of EOF\" &&\n+\tfile4_data=abcd &&\n+\tfile4_len=4 &&\n+\tfile5_data=\"an inline file.\n+  we should see it later.\" &&\n+\tfile6_data=\"#!/bin/sh\n+echo \\\"\\$@\\\"\" &&\n \tnote1_data=\"The first note for the first commit\" &&\n \tnote2_data=\"The first note for the second commit\" &&\n \tnote3_data=\"The first note for the third commit\" &&\n@@ -2032,7 +2042,7 @@ test_expect_success 'Q: commit notes' '\n \tnote2b_data=\"The second note for the second commit\" &&\n \n \ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n+\tcat >repo/input <<-INPUT_END &&\n \tblob\n \tmark :2\n \tdata <<EOF\n@@ -2143,199 +2153,285 @@ test_expect_success 'Q: commit notes' '\n \n \tINPUT_END\n \n-\tgit fast-import <input &&\n-\tgit log --raw notes-test\n-'\n+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <repo/input &&\n+\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n+\tcommit2=$(git -C repo rev-parse notes-test^) &&\n+\tcommit3=$(git -C repo rev-parse notes-test)\n+}\n \n test_expect_success 'Q: verify pack' '\n-\tverify_packs\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n '\n \n test_expect_success 'Q: verify first commit' '\n-\tcommit1=$(git rev-parse notes-test~2) &&\n-\tcommit2=$(git rev-parse notes-test^) &&\n-\tcommit3=$(git rev-parse notes-test) &&\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\tfirst (:3)\n-\tEOF\n-\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tfirst (:3)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $commit1\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit1\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tsecond (:5)\n-\tEOF\n-\tgit cat-file commit notes-test^ | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tsecond (:5)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $commit2\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit2\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tthird (:6)\n-\tEOF\n-\tgit cat-file commit notes-test | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tthird (:6)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first notes commit' '\n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:9)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:9)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit1\n-\t100644 blob $commit2\n-\t100644 blob $commit3\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for first commit' '\n-\techo \"$note1_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for second commit' '\n-\techo \"$note2_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for third commit' '\n-\techo \"$note3_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second notes commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $(git rev-parse --verify refs/notes/foobar~2)\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar~2)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:10)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:10)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit1\n-\t100644 blob $commit2\n-\t100644 blob $commit3\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second note for first commit' '\n-\techo \"$note1b_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for second commit' '\n-\techo \"$note2_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for third commit' '\n-\techo \"$note3_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third notes commit' '\n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:11)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:11)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit1\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third note for first commit' '\n-\techo \"$note1c_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1c_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify fourth notes commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $(git rev-parse --verify refs/notes/foobar^)\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar^)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:12)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:12)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify fourth notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit2\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit2\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second note for second commit' '\n-\techo \"$note2b_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: deny note on empty branch' '\n-\tcat >input <<-EOF &&\n-\treset refs/heads/Q0\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-EOF &&\n+\t\treset refs/heads/Q0\n \n-\tcommit refs/heads/note-Q0\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tNote for an empty branch.\n-\tCOMMIT\n+\t\tcommit refs/heads/note-Q0\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tNote for an empty branch.\n+\t\tCOMMIT\n \n-\tN inline refs/heads/Q0\n-\tdata <<NOTE\n-\tsome note\n-\tNOTE\n-\tEOF\n-\ttest_must_fail git fast-import <input\n+\t\tN inline refs/heads/Q0\n+\t\tdata <<NOTE\n+\t\tsome note\n+\t\tNOTE\n+\t\tEOF\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558061","messageId":"20261110-kn-fast-import-tests-1-v1-7-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 07/20] t9300: make the series P tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:52Z","receivedAt":"2026-11-10T11:49:52Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series P' to make\nthem independent of state from previous tests.\n\nMove the setup to a 'setup_gitlinks_repo()' function, so each test can\ninvoke it.\n\nThe 'fail on inline gitlink' and 'fail on blob mark in gitlink' tests\ncreate their commit on top of 'subuse2', which is only written by the\n'verbatim SHA gitlinks' test. Use 'subuse1' from the setup instead, as\nthese tests only check that the invalid gitlink is rejected.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 290 +++++++++++++++++++++++++++----------------------\n 1 file changed, 161 insertions(+), 129 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 9b1827bae2..480ae2c47f 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1866,157 +1866,189 @@ test_expect_success 'O: progress outputs as requested by input' '\n ### series P (gitlinks)\n ###\n \n-test_expect_success 'P: superproject & submodule mix' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata 10\n-\ttest file\n-\n-\treset refs/heads/sub\n-\tcommit refs/heads/sub\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 12\n-\tsub_initial\n-\tM 100644 :1 file\n-\n-\tblob\n-\tmark :3\n-\tdata <<DATAEND\n-\t[submodule \"sub\"]\n-\t\tpath = sub\n-\t\turl = \"$(pwd)/sub\"\n-\tDATAEND\n-\n-\tcommit refs/heads/subuse1\n-\tmark :4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 8\n-\tinitial\n-\tfrom refs/heads/main\n-\tM 100644 :3 .gitmodules\n-\tM 160000 :2 sub\n-\n-\tblob\n-\tmark :5\n-\tdata 20\n-\ttest file\n-\tmore data\n-\n-\tcommit refs/heads/sub\n-\tmark :6\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 11\n-\tsub_second\n-\tfrom :2\n-\tM 100644 :5 file\n-\n-\tcommit refs/heads/subuse1\n-\tmark :7\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 7\n-\tsecond\n-\tfrom :4\n-\tM 160000 :6 sub\n-\n-\tINPUT_END\n-\n-\tgit fast-import <input &&\n-\tgit checkout subuse1 &&\n-\trm -rf sub &&\n-\tmkdir sub &&\n+setup_gitlinks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo base &&\n \t(\n-\t\tcd sub &&\n-\t\tgit init &&\n-\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n-\t\tgit checkout main\n-\t) &&\n-\tgit submodule init &&\n-\tgit submodule update\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 10\n+\t\ttest file\n+\n+\t\treset refs/heads/sub\n+\t\tcommit refs/heads/sub\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 12\n+\t\tsub_initial\n+\t\tM 100644 :1 file\n+\n+\t\tblob\n+\t\tmark :3\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :3 .gitmodules\n+\t\tM 160000 :2 sub\n+\n+\t\tblob\n+\t\tmark :5\n+\t\tdata 20\n+\t\ttest file\n+\t\tmore data\n+\n+\t\tcommit refs/heads/sub\n+\t\tmark :6\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 11\n+\t\tsub_second\n+\t\tfrom :2\n+\t\tM 100644 :5 file\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :7\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :4\n+\t\tM 160000 :6 sub\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input\n+\t)\n+}\n+\n+test_expect_success 'P: superproject & submodule mix' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit checkout subuse1 &&\n+\t\trm -rf sub &&\n+\t\tmkdir sub &&\n+\t\t(\n+\t\t\tcd sub &&\n+\t\t\tgit init &&\n+\t\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n+\t\t\tgit checkout main\n+\t\t) &&\n+\t\tgit submodule init &&\n+\t\tgit submodule update\n+\t)\n '\n \n test_expect_success 'P: verbatim SHA gitlinks' '\n-\tSUBLAST=$(git rev-parse --verify sub) &&\n-\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<DATAEND\n-\t[submodule \"sub\"]\n-\t\tpath = sub\n-\t\turl = \"$(pwd)/sub\"\n-\tDATAEND\n+\t\tSUBLAST=$(git rev-parse --verify sub) &&\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n \n-\tcommit refs/heads/subuse2\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 8\n-\tinitial\n-\tfrom refs/heads/main\n-\tM 100644 :1 .gitmodules\n-\tM 160000 $SUBPREV sub\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n \n-\tcommit refs/heads/subuse2\n-\tmark :3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 7\n-\tsecond\n-\tfrom :2\n-\tM 160000 $SUBLAST sub\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :1 .gitmodules\n+\t\tM 160000 $SUBPREV sub\n \n-\tINPUT_END\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :2\n+\t\tM 160000 $SUBLAST sub\n \n-\tgit branch -D sub &&\n-\tgit gc --prune=now &&\n-\tgit fast-import <input &&\n-\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n+\t\tINPUT_END\n+\n+\t\tgit branch -D sub &&\n+\t\tgit gc --prune=now &&\n+\t\tgit fast-import <input &&\n+\t\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n+\t)\n '\n \n test_expect_success 'P: fail on inline gitlink' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/subuse3\n-\tmark :1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcorrupt\n-\tCOMMIT\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tfrom refs/heads/subuse2\n-\tM 160000 inline sub\n-\tdata <<DATA\n-\t$SUBPREV\n-\tDATA\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 inline sub\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n \n-\ttest_must_fail git fast-import <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'P: fail on blob mark in gitlink' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<DATA\n-\t$SUBPREV\n-\tDATA\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/subuse3\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcorrupt\n-\tCOMMIT\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n \n-\tfrom refs/heads/subuse2\n-\tM 160000 :1 sub\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 :1 sub\n \n-\ttest_must_fail git fast-import <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558062","messageId":"20261110-kn-fast-import-tests-1-v1-8-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 08/20] t9300: make the series O tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:53Z","receivedAt":"2026-11-10T11:49:53Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series O' to make\nthem independent of state from previous tests.\n\nThe tests import on top of 'branch' and compare the result against the\n'N3' commit from series N. Import on top of a commit created by the new\n'setup_import_repo()' function instead, and compare the result against\nthe same commit imported from a stream without comments and with blank\nlines, so that the whole commit is still checked and not just its tree.\nThe function sets 'fastimport.unpackLimit' to 0, which 'O: blank lines\nnot necessary after other commands' relies on.\n\nDrop the 'O: repack before next test' test, and repack in the test\nwhich relies on it.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 291 +++++++++++++++++++++++++++++++------------------\n 1 file changed, 182 insertions(+), 109 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 480ae2c47f..75c2de46ed 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1723,143 +1723,216 @@ done\n ### series O\n ###\n \n-test_expect_success 'O: comments are all skipped' '\n-\tcat >input <<-INPUT_END &&\n-\t#we will\n-\tcommit refs/heads/O1\n-\t# -- ignore all of this text\n+setup_import_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tgit -C repo config fastimport.unpackLimit 0 &&\n+\tmkdir repo/file2 &&\n+\techo abcd >repo/file2/file4 &&\n+\tgit -C repo add file2/file4 &&\n+\ttest_tick &&\n+\tgit -C repo commit -m base\n+}\n+\n+import_reference_commit () {\n+\tgit fast-import <<-INPUT_END\n+\tcommit refs/heads/$1\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata <<COMMIT\n \tdirty directory copy\n \tCOMMIT\n \n-\t# do not forget the import blank line!\n-\t#\n-\t# yes, we started from our usual base of branch^0.\n-\t# i like branch^0.\n-\tfrom refs/heads/branch^0\n-\t# and we need to reuse file2/file5 from N3 above.\n+\tfrom refs/heads/main\n \tM 644 inline file2/file5\n-\t# otherwise the tree will be different\n \tdata <<EOF\n-\t$file5_data\n+\tan inline file.\n+\t  we should see it later.\n \tEOF\n \n-\t# do not forget to copy file2 to file3\n \tC file2 file3\n-\t#\n-\t# or to delete file5 from file2.\n \tD file2/file5\n-\t# are we done yet?\n \n \tINPUT_END\n+}\n \n-\tgit fast-import <input &&\n-\ttest $(git rev-parse N3) = $(git rev-parse O1)\n+test_expect_success 'O: comments are all skipped' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\t#we will\n+\t\tcommit refs/heads/O1\n+\t\t# -- ignore all of this text\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\n+\t\t# do not forget the import blank line!\n+\t\t#\n+\t\t# yes, we started from our usual base of main.\n+\t\t# i like main.\n+\t\tfrom refs/heads/main\n+\t\t# and we need to add file2/file5 to file2.\n+\t\tM 644 inline file2/file5\n+\t\t# otherwise the tree will be different\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\n+\t\t# do not forget to copy file2 to file3\n+\t\tC file2 file3\n+\t\t#\n+\t\t# or to delete file5 from file2.\n+\t\tD file2/file5\n+\t\t# are we done yet?\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O1 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O1-reference &&\n+\t\ttest_cmp_rev O1-reference O1\n+\t)\n '\n \n test_expect_success 'O: blank lines not necessary after data commands' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/O2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tdirty directory copy\n-\tCOMMIT\n-\tfrom refs/heads/branch^0\n-\tM 644 inline file2/file5\n-\tdata <<EOF\n-\t$file5_data\n-\tEOF\n-\tC file2 file3\n-\tD file2/file5\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\t\tfrom refs/heads/main\n+\t\tM 644 inline file2/file5\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\t\tC file2 file3\n+\t\tD file2/file5\n \n-\tgit fast-import <input &&\n-\ttest $(git rev-parse N3) = $(git rev-parse O2)\n-'\n+\t\tINPUT_END\n \n-test_expect_success 'O: repack before next test' '\n-\tgit repack -a -d\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O2 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O2-reference &&\n+\t\ttest_cmp_rev O2-reference O2\n+\t)\n '\n \n test_expect_success 'O: blank lines not necessary after other commands' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/O3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzstring\n-\tCOMMIT\n-\tcommit refs/heads/O3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzof\n-\tCOMMIT\n-\tcheckpoint\n-\tcommit refs/heads/O3\n-\tmark :5\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzempty\n-\tCOMMIT\n-\tcheckpoint\n-\tcommit refs/heads/O3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzcommits\n-\tCOMMIT\n-\treset refs/tags/O3-2nd\n-\tfrom :5\n-\treset refs/tags/O3-3rd\n-\tfrom :5\n-\tINPUT_END\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tgit repack -a -d &&\n \n-\tcat >expect <<-INPUT_END &&\n-\tstring\n-\tof\n-\tempty\n-\tcommits\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tmark :5\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\treset refs/tags/O3-2nd\n+\t\tfrom :5\n+\t\treset refs/tags/O3-3rd\n+\t\tfrom :5\n+\t\tINPUT_END\n \n-\tgit fast-import <input &&\n-\tls -la .git/objects/pack/pack-*.pack >packlist &&\n-\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n-\ttest_line_count = 4 idxlist &&\n-\ttest_line_count = 4 packlist &&\n-\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n-\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n-\ttest_cmp expect actual\n+\t\tcat >expect <<-INPUT_END &&\n+\t\tstring\n+\t\tof\n+\t\tempty\n+\t\tcommits\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tls -la .git/objects/pack/pack-*.pack >packlist &&\n+\t\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n+\t\ttest_line_count = 4 idxlist &&\n+\t\ttest_line_count = 4 packlist &&\n+\t\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n+\t\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'O: progress outputs as requested by input' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzstring\n-\tCOMMIT\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzof\n-\tCOMMIT\n-\tprogress Two commits down, 2 to go!\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzempty\n-\tCOMMIT\n-\tprogress Three commits down, 1 to go!\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzcommits\n-\tCOMMIT\n-\tprogress done!\n-\tINPUT_END\n-\tgit fast-import <input >actual &&\n-\tgrep \"progress \" <input >expect &&\n-\ttest_cmp expect actual\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tprogress Two commits down, 2 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tprogress Three commits down, 1 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\tprogress done!\n+\t\tINPUT_END\n+\t\tgit fast-import <input >actual &&\n+\t\tgrep \"progress \" <input >expect &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558063","messageId":"20261110-kn-fast-import-tests-1-v1-9-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 09/20] t9300: make the big blob tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:54Z","receivedAt":"2026-11-10T11:49:54Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the big blob tests in 'series R'\nto make them independent of state from previous tests.\n\n'R: blob bigger than threshold' imports the blobs, and the tests after\nit inspect the result. Fold them into a single test, which does the\nimport and checks the pack, the blob contents and that the blob is\nstored only once.\n\nSet 'fastimport.unpackLimit' to 0 for the import so that a pack is\nwritten, and verify it with an inline loop in place of 'verify_packs()',\nwhich won't be available once the test is moved to another file.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 79 ++++++++++++++++++++++++--------------------------\n 1 file changed, 38 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 75c2de46ed..9f4aea09dd 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3148,51 +3148,48 @@ test_expect_success 'R: corrupt lines do not mess marks file' '\n ## R: very large blobs\n ##\n test_expect_success 'R: blob bigger than threshold' '\n-\tblobsize=$((2*1024*1024 + 53)) &&\n-\ttest-tool genrandom bar $blobsize >expect &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/big-file\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tR - big file\n-\tCOMMIT\n-\n-\tM 644 inline big1\n-\tdata $blobsize\n-\tINPUT_END\n-\tcat expect >>input &&\n-\tcat >>input <<-INPUT_END &&\n-\tM 644 inline big2\n-\tdata $blobsize\n-\tINPUT_END\n-\tcat expect >>input &&\n-\techo >>input &&\n-\n-\ttest_create_repo R &&\n-\tgit --git-dir=R/.git config fastimport.unpackLimit 0 &&\n-\tgit --git-dir=R/.git fast-import --big-file-threshold=1 <input\n-'\n-\n-test_expect_success 'R: verify created pack' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\tcd R &&\n-\t\tverify_packs -v > ../verify\n+\t\tcd repo &&\n+\n+\t\tblobsize=$((2*1024*1024 + 53)) &&\n+\t\ttest-tool genrandom bar $blobsize >expect &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/big-file\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tR - big file\n+\t\tCOMMIT\n+\n+\t\tM 644 inline big1\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\tcat >>input <<-INPUT_END &&\n+\t\tM 644 inline big2\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\techo >>input &&\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --big-file-threshold=1 <input &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack -v \"$p\" || return 1\n+\t\tdone >verify &&\n+\n+\t\tgit cat-file blob big-file:big1 >actual &&\n+\t\ttest_cmp_bin expect actual &&\n+\t\ta=$(git rev-parse big-file:big1) &&\n+\t\tb=$(git rev-parse big-file:big2) &&\n+\t\ttest $a = $b &&\n+\t\tn=$(grep $a verify | wc -l) &&\n+\t\ttest 1 = $n\n \t)\n '\n \n-test_expect_success 'R: verify written objects' '\n-\tgit --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n-\ttest_cmp_bin expect actual &&\n-\ta=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n-\tb=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n-\ttest $a = $b\n-'\n-\n-test_expect_success 'R: blob appears only once' '\n-\tn=$(grep $a verify | wc -l) &&\n-\ttest 1 = $n\n-'\n-\n ###\n ### series S (mark and path parsing)\n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558064","messageId":"20261110-kn-fast-import-tests-1-v1-10-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 10/20] t9300: make the ref update tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:55Z","receivedAt":"2026-11-10T11:49:55Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the reference update tests in\nseries 'F', 'G', 'J' and 'K' to make them independent of state from\nprevious tests. Add a 'setup_two_commit_repo()' function which creates\na repository with two commits on 'main', so each test can invoke it.\nThe tests used to build on the 'branch' branch of earlier tests.\n\nFold the tests which only check the result of an import into the tests\nperforming it, as they can't run on their own. As\n'fastimport.unpackLimit' is no longer set by an earlier test, set it for\nthe 'F' and 'G' imports so that a pack is written, and verify it with an\ninline loop in place of 'verify_packs()'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 214 +++++++++++++++++++++++++++----------------------\n 1 file changed, 119 insertions(+), 95 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 9f4aea09dd..9576df78a1 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -865,43 +865,53 @@ test_expect_success 'E: verify commit' '\n ### series F\n ###\n \n+setup_two_commit_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo one &&\n+\ttest_commit -C repo two\n+}\n+\n test_expect_success 'F: non-fast-forward update skips' '\n-\told_branch=$(git rev-parse --verify branch^0) &&\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tlosing things already?\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch~1\n+\t\tfrom refs/heads/main~1\n \n-\treset refs/heads/other\n-\tfrom refs/heads/branch\n+\t\treset refs/heads/other\n+\t\tfrom refs/heads/main\n \n-\tINPUT_END\n+\t\tINPUT_END\n \n-\ttest_must_fail git fast-import <input &&\n-\t# branch must remain unaffected\n-\ttest $old_branch = $(git rev-parse --verify branch^0)\n-'\n+\t\ttest_must_fail git -c fastimport.unpackLimit=0 fast-import <input &&\n+\t\t# branch must remain unaffected\n+\t\ttest $old_branch = $(git rev-parse --verify main^0) &&\n \n-test_expect_success 'F: verify pack' '\n-\tverify_packs\n-'\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone &&\n \n-test_expect_success 'F: verify other commit' '\n-\tcat >expect <<-EOF &&\n-\ttree $(git rev-parse branch~1^{tree})\n-\tparent $(git rev-parse branch~1)\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcat >expect <<-EOF &&\n+\t\ttree $(git rev-parse main~1^{tree})\n+\t\tparent $(git rev-parse main~1)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tlosing things already?\n-\tEOF\n-\tgit cat-file commit other >actual &&\n-\ttest_cmp expect actual\n+\t\tlosing things already?\n+\t\tEOF\n+\t\tgit cat-file commit other >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n ###\n@@ -909,28 +919,31 @@ test_expect_success 'F: verify other commit' '\n ###\n \n test_expect_success 'G: non-fast-forward update forced' '\n-\told_branch=$(git rev-parse --verify branch^0) &&\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tlosing things already?\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch~1\n+\t\tfrom refs/heads/main~1\n \n-\tINPUT_END\n-\tgit fast-import --force <input\n-'\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --force <input &&\n+\t\t# branch changed, but logged\n+\t\ttest $old_branch != $(git rev-parse --verify main^0) &&\n+\t\ttest $old_branch = $(git rev-parse --verify main@{1}) &&\n \n-test_expect_success 'G: verify pack' '\n-\tverify_packs\n-'\n-\n-test_expect_success 'G: branch changed, but logged' '\n-\ttest $old_branch != $(git rev-parse --verify branch^0) &&\n-\ttest $old_branch = $(git rev-parse --verify branch@{1})\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n '\n \n ###\n@@ -1017,42 +1030,50 @@ test_expect_success 'I: verify edge list' '\n ###\n \n test_expect_success 'J: reset existing branch creates empty commit' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/J\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcreate J\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate J\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch\n+\t\tfrom refs/heads/main\n \n-\treset refs/heads/J\n+\t\treset refs/heads/J\n \n-\tcommit refs/heads/J\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tinitialize J\n-\tCOMMIT\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitialize J\n+\t\tCOMMIT\n \n-\tINPUT_END\n-\tgit fast-import <input\n-'\n-test_expect_success 'J: branch has 1 commit, empty tree' '\n-\ttest 1 = $(git rev-list J | wc -l) &&\n-\ttest 0 = $(git ls-tree J | wc -l)\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# branch has 1 commit, empty tree\n+\t\ttest 1 = $(git rev-list J | wc -l) &&\n+\t\ttest 0 = $(git ls-tree J | wc -l)\n+\t)\n '\n \n test_expect_success 'J: tag must fail on empty branch' '\n-\tcat >input <<-INPUT_END &&\n-\treset refs/heads/J2\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\treset refs/heads/J2\n \n-\ttag wrong_tag\n-\tfrom refs/heads/J2\n-\tdata <<EOF\n-\tTag branch that was reset.\n-\tEOF\n-\tINPUT_END\n-\ttest_must_fail git fast-import <input\n+\t\ttag wrong_tag\n+\t\tfrom refs/heads/J2\n+\t\tdata <<EOF\n+\t\tTag branch that was reset.\n+\t\tEOF\n+\t\tINPUT_END\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n@@ -1060,29 +1081,32 @@ test_expect_success 'J: tag must fail on empty branch' '\n ###\n \n test_expect_success 'K: reinit branch with from' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/K\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcreate K\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate K\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch\n+\t\tfrom refs/heads/main\n \n-\tcommit refs/heads/K\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tredo K\n-\tCOMMIT\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tredo K\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch^1\n+\t\tfrom refs/heads/main^1\n \n-\tINPUT_END\n-\tgit fast-import <input\n-'\n-test_expect_success 'K: verify K^1 = branch^1' '\n-\ttest $(git rev-parse --verify branch^1) \\\n-\t\t= $(git rev-parse --verify K^1)\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# K^1 = main^1\n+\t\ttest $(git rev-parse --verify main^1) \\\n+\t\t\t= $(git rev-parse --verify K^1)\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558065","messageId":"20261110-kn-fast-import-tests-1-v1-11-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 11/20] t9300: make the date format tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:56Z","receivedAt":"2026-11-10T11:49:56Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the date format tests to\nmake them independent of state from previous tests.\n\nFold the 'E: verify pack' and 'E: verify commit' tests into the test\nperforming the import. As 'fastimport.unpackLimit' is no longer set by\nan earlier test, set it for the import so that a pack is written, and\nverify the pack with an inline loop in place of 'verify_packs()'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 72 ++++++++++++++++++++++++++++++++++----------------\n 1 file changed, 49 insertions(+), 23 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 9576df78a1..5b0101700d 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -828,37 +828,63 @@ test_expect_success 'D: verify file6' '\n ###\n \n test_expect_success 'E: rfc2822 date, --date-format=raw' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n-\tdata <<COMMIT\n-\tRFC 2822 type date\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n \n-\tfrom refs/heads/branch^0\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/main^0\n \n-\ttest_must_fail git fast-import --date-format=raw <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import --date-format=raw <input\n+\t)\n '\n+\n test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n-\tgit fast-import --date-format=rfc2822 <input\n-'\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n \n-test_expect_success 'E: verify pack' '\n-\tverify_packs\n-'\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n \n-test_expect_success 'E: verify commit' '\n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n+\t\tfrom refs/heads/main^0\n \n-\tRFC 2822 type date\n-\tEOF\n-\tgit cat-file commit branch | sed 1,2d >actual &&\n-\ttest_cmp expect actual\n+\t\tINPUT_END\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --date-format=rfc2822 <input &&\n+\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n+\n+\t\tRFC 2822 type date\n+\t\tEOF\n+\t\tgit cat-file commit main | sed 1,2d >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558066","messageId":"20261110-kn-fast-import-tests-1-v1-12-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 12/20] t9300: make the pack edges test self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:57Z","receivedAt":"2026-11-10T11:49:57Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the pack-edges tests to make\nthem independent of state from previous tests.\n\nFold 'I: verify edge list' into the test creating the edge list, as it\ncan't run on its own. Pack edges are only recorded for packs which are\nkept, so set 'fastimport.unpackLimit' to 0 for the import.\n\nCreate the repository with 'git init -b main', as the import builds on\n'main' and t9302, where this test ends up, doesn't set\n'GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 39 +++++++++++++++++++++++----------------\n 1 file changed, 23 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 5b0101700d..f55604bb87 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1030,25 +1030,32 @@ test_expect_success 'H: verify file' '\n ###\n \n test_expect_success 'I: export-pack-edges' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/export-boundary\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\twe have a border.  its only 40 characters wide.\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init -b main repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n \n-\tfrom refs/heads/branch\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/export-boundary\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\twe have a border.  its only 40 characters wide.\n+\t\tCOMMIT\n \n-\tINPUT_END\n-\tgit fast-import --export-pack-edges=edges.list <input\n-'\n+\t\tfrom refs/heads/main\n \n-test_expect_success 'I: verify edge list' '\n-\tcat >expect <<-EOF &&\n-\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n-\tEOF\n-\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\ttest_cmp expect actual\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n+\t\t\t--export-pack-edges=edges.list <input &&\n+\n+\t\t# verify edge list\n+\t\tcat >expect <<-EOF &&\n+\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n+\t\tEOF\n+\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558067","messageId":"20261110-kn-fast-import-tests-1-v1-13-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 13/20] t9300: make the marks tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:58Z","receivedAt":"2026-11-10T11:49:58Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the marks tests to make them\nindependent of state from previous tests.\n\nSeveral tests import the marks file written by an earlier test. Add a\n'create_marks_file()' function which writes one, with marks for commits\nand tags too, so each test can invoke it in its own repository.\n\n'R: feature import-marks-if-exists' writes a marks file pointing to a\nblob it never stores, relying on an earlier test having written it.\nWrite the blob in the test itself. Also run 'A: export marks with large\nvalues' in its own repository.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 512 +++++++++++++++++++++++++++++++------------------\n 1 file changed, 322 insertions(+), 190 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex f55604bb87..82348c65cc 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -298,59 +298,65 @@ test_expect_success 'A: verify diff' '\n '\n \n test_expect_success 'A: export marks with large values' '\n-\ttest_tick &&\n-\tmt=$(git hash-object --stdin < /dev/null) &&\n-\t>input.blob &&\n-\t>marks.exp &&\n-\t>tree.exp &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcat >input.commit <<-EOF &&\n-\tcommit refs/heads/verify--dump-marks\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\ttest the sparse array dumping routines with exponentially growing marks\n-\tCOMMIT\n-\tEOF\n+\t\ttest_tick &&\n+\t\tmt=$(git hash-object --stdin < /dev/null) &&\n+\t\t>input.blob &&\n+\t\t>marks.exp &&\n+\t\t>tree.exp &&\n \n-\ti=0 l=4 m=6 n=7 &&\n-\twhile test \"$i\" -lt 27\n-\tdo\n-\t\tcat >>input.blob <<-EOF &&\n-\t\tblob\n-\t\tmark :$l\n-\t\tdata 0\n-\t\tblob\n-\t\tmark :$m\n-\t\tdata 0\n-\t\tblob\n-\t\tmark :$n\n-\t\tdata 0\n+\t\tcat >input.commit <<-EOF &&\n+\t\tcommit refs/heads/verify--dump-marks\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttest the sparse array dumping routines with exponentially growing marks\n+\t\tCOMMIT\n \t\tEOF\n-\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n-\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n-\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n \n-\t\techo \":$l $mt\" >>marks.exp &&\n-\t\techo \":$m $mt\" >>marks.exp &&\n-\t\techo \":$n $mt\" >>marks.exp &&\n+\t\ti=0 l=4 m=6 n=7 &&\n+\t\twhile test \"$i\" -lt 27\n+\t\tdo\n+\t\t\tcat >>input.blob <<-EOF &&\n+\t\t\tblob\n+\t\t\tmark :$l\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$m\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$n\n+\t\t\tdata 0\n+\t\t\tEOF\n+\t\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n \n-\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n-\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n-\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n+\t\t\techo \":$l $mt\" >>marks.exp &&\n+\t\t\techo \":$m $mt\" >>marks.exp &&\n+\t\t\techo \":$n $mt\" >>marks.exp &&\n \n-\t\tl=$(($l + $l)) &&\n-\t\tm=$(($m + $m)) &&\n-\t\tn=$(($l + $n)) &&\n+\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n \n-\t\ti=$((1 + $i)) || return 1\n-\tdone &&\n+\t\t\tl=$(($l + $l)) &&\n+\t\t\tm=$(($m + $m)) &&\n+\t\t\tn=$(($l + $n)) &&\n \n-\tsort tree.exp > tree.exp_s &&\n+\t\t\ti=$((1 + $i)) || return 1\n+\t\tdone &&\n \n-\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n-\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n-\ttest_cmp tree.exp_s tree.out &&\n-\ttest_cmp marks.exp marks.large\n+\t\tsort tree.exp > tree.exp_s &&\n+\n+\t\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n+\t\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n+\t\ttest_cmp tree.exp_s tree.out &&\n+\t\ttest_cmp marks.exp marks.large\n+\t)\n '\n \n ###\n@@ -2652,196 +2658,316 @@ test_expect_success 'R: export-marks feature forbidden by default' '\n '\n \n test_expect_success 'R: export-marks feature results in a marks file being created' '\n-\tcat >input <<-EOF &&\n-\tfeature export-marks=git.marks\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n+\t\tcat >input <<-EOF &&\n+\t\tfeature export-marks=git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n \n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_grep :1 git.marks\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_grep :1 git.marks\n+\t)\n '\n \n test_expect_success 'R: export-marks options can be overridden by commandline options' '\n-\tcat >input <<-\\EOF &&\n-\tfeature export-marks=feature-sub/git.marks\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --allow-unsafe-features \\\n-\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n-\ttest_grep :1 cmdline-sub/other.marks &&\n-\ttest_path_is_missing feature-sub\n+\t\tcat >input <<-\\EOF &&\n+\t\tfeature export-marks=feature-sub/git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\tgit fast-import --allow-unsafe-features \\\n+\t\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n+\t\ttest_grep :1 cmdline-sub/other.marks &&\n+\t\ttest_path_is_missing feature-sub\n+\t)\n '\n \n test_expect_success 'R: catch typo in marks file name' '\n-\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n-\techo \"feature import-marks=nonexistent.marks\" |\n-\ttest_must_fail git fast-import --allow-unsafe-features\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n+\t\techo \"feature import-marks=nonexistent.marks\" |\n+\t\ttest_must_fail git fast-import --allow-unsafe-features\n+\t)\n '\n \n test_expect_success 'R: import and output marks can be the same file' '\n-\trm -f io.marks &&\n-\tblob=$(echo hi | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t:1 $blob\n-\t:2 $blob\n-\tEOF\n-\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n-\tblob\n-\tmark :2\n-\tdata 3\n-\thi\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n \n-\tEOF\n-\ttest_cmp expect io.marks\n+\t\tEOF\n+\t\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n '\n \n test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n-\trm -f io.marks &&\n-\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n+\t\trm -f io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t)\n '\n \n test_expect_success 'R: --import-marks-if-exists' '\n-\trm -f io.marks &&\n-\tblob=$(echo hi | git hash-object --stdin) &&\n-\techo \":1 $blob\" >expect &&\n-\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\ttest_cmp expect io.marks\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n '\n \n test_expect_success 'R: feature import-marks-if-exists' '\n-\trm -f io.marks &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit fast-import --export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=not_io.marks\n-\tEOF\n-\ttest_must_be_empty io.marks &&\n+\t\trm -f io.marks &&\n \n-\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks &&\n \n-\techo \":1 $blob\" >io.marks &&\n-\techo \":1 $blob\" >expect &&\n-\techo \":2 $blob\" >>expect &&\n+\t\tblob=$(echo hi | git hash-object -w --stdin) &&\n \n-\tgit fast-import --export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=io.marks\n-\tblob\n-\tmark :2\n-\tdata 3\n-\thi\n+\t\techo \":1 $blob\" >io.marks &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\techo \":2 $blob\" >>expect &&\n \n-\tEOF\n-\ttest_cmp expect io.marks &&\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n \n-\techo \":3 $blob\" >>expect &&\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n \n-\tgit fast-import --import-marks=io.marks \\\n-\t\t\t--export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=not_io.marks\n-\tblob\n-\tmark :3\n-\tdata 3\n-\thi\n+\t\techo \":3 $blob\" >>expect &&\n \n-\tEOF\n-\ttest_cmp expect io.marks &&\n+\t\tgit fast-import --import-marks=io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tblob\n+\t\tmark :3\n+\t\tdata 3\n+\t\thi\n \n-\tgit fast-import --import-marks-if-exists=not_io.marks \\\n-\t\t\t--export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=io.marks\n-\tEOF\n-\ttest_must_be_empty io.marks\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n+\n+\t\tgit fast-import --import-marks-if-exists=not_io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks\n+\t)\n '\n \n-test_expect_success 'R: import to output marks works without any content' '\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=marks.out\n-\tfeature export-marks=marks.new\n-\tEOF\n+create_marks_file () {\n+\tgit fast-import --export-marks=\"$1\" <<-EOF\n+\tblob\n+\tmark :1\n+\tdata 4\n+\tone\n \n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_cmp marks.out marks.new\n+\tblob\n+\tmark :2\n+\tdata 4\n+\ttwo\n+\n+\tblob\n+\tmark :3\n+\tdata 6\n+\tthree\n+\n+\tblob\n+\tmark :4\n+\tdata 5\n+\tfour\n+\n+\tcommit refs/heads/marks\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit with a mark\n+\tCOMMIT\n+\tM 100644 :1 one\n+\n+\ttag marks-tag\n+\tmark :6\n+\tfrom :5\n+\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<TAG\n+\ttag with a mark\n+\tTAG\n+\n+\tEOF\n+}\n+\n+test_expect_success 'R: import to output marks works without any content' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=marks.out\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n '\n \n test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=nonexistent.marks\n-\tfeature export-marks=marks.new\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n-\ttest_cmp marks.out marks.new\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n '\n \n-\n test_expect_success 'R: multiple --import-marks= should be honoured' '\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=nonexistent.marks\n-\tfeature export-marks=combined.marks\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\thead -n2 marks.out > one.marks &&\n-\ttail -n +3 marks.out > two.marks &&\n-\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n-\t\t--allow-unsafe-features <input &&\n-\ttest_cmp marks.out combined.marks\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=combined.marks\n+\t\tEOF\n+\n+\t\thead -n2 marks.out >one.marks &&\n+\t\ttail -n +3 marks.out >two.marks &&\n+\t\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n+\t\t\t--allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out combined.marks\n+\t)\n '\n \n test_expect_success 'R: feature relative-marks should be honoured' '\n-\tcat >input <<-EOF &&\n-\tfeature relative-marks\n-\tfeature import-marks=relative.in\n-\tfeature export-marks=relative.out\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\tmkdir -p .git/info/fast-import/ &&\n-\tcp marks.new .git/info/fast-import/relative.in &&\n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_cmp marks.new .git/info/fast-import/relative.out\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature export-marks=relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out .git/info/fast-import/relative.out\n+\t)\n '\n \n test_expect_success 'R: feature no-relative-marks should be honoured' '\n-\tcat >input <<-EOF &&\n-\tfeature relative-marks\n-\tfeature import-marks=relative.in\n-\tfeature no-relative-marks\n-\tfeature export-marks=non-relative.out\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_cmp marks.new non-relative.out\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature no-relative-marks\n+\t\tfeature export-marks=non-relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out non-relative.out\n+\t)\n '\n \n+\n test_expect_success 'R: feature ls supported' '\n \techo \"feature ls\" |\n \tgit fast-import\n@@ -3187,18 +3313,24 @@ test_expect_success 'R: ignore non-git options' '\n '\n \n test_expect_success 'R: corrupt lines do not mess marks file' '\n-\trm -f io.marks &&\n-\tblob=$(echo hi | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t:3 $ZERO_OID\n-\t:1 $blob\n-\t:2 $blob\n-\tEOF\n-\tcp expect io.marks &&\n-\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\ttest_cmp expect io.marks\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:3 $ZERO_OID\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tcp expect io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n '\n \n ##\n\n-- \n2.56.GIT\n\n\n"},{"id":"558068","messageId":"20261110-kn-fast-import-tests-1-v1-14-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 14/20] t9300: make the series Y tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:49:59Z","receivedAt":"2026-11-10T11:49:59Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the 'series Y' tests to make\nthem independent of state from previous tests.\n\nThe 'Y: setup' test only fills the OID cache for 'Y: rewrite\nsubmodules', so merge it into that test. Also clean up the\nrepositories created by the tests.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 9 ++++-----\n 1 file changed, 4 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 82348c65cc..04c3bfe0c1 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -4498,14 +4498,12 @@ cat >Y-marks <<\\Y_INPUT_END\n :4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n Y_INPUT_END\n \n-test_expect_success 'Y: setup' '\n-\ttest_oid_cache <<-EOF\n+test_expect_success 'Y: rewrite submodules' '\n+\ttest_when_finished \"rm -rf main1\" &&\n+\ttest_oid_cache <<-EOF &&\n \tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n \tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n \tEOF\n-'\n-\n-test_expect_success 'Y: rewrite submodules' '\n \tgit init main1 &&\n \t(\n \t\tcd main1 &&\n@@ -4525,6 +4523,7 @@ test_expect_success 'Y: reference pending tag or commit' '\n \tpending_tag sha256:85edc5eac315bc680677b2fc71622bd77476f057eb8dc8ed6a497803a24f1f46\n \tEOF\n \n+\ttest_when_finished \"rm -rf reference-pending\" &&\n \tgit init reference-pending &&\n \t(\n \t\tcd reference-pending &&\n\n-- \n2.56.GIT\n\n\n"},{"id":"558069","messageId":"20261110-kn-fast-import-tests-1-v1-15-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 15/20] t9300: make the cat-blob tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:50:00Z","receivedAt":"2026-11-10T11:50:00Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'R: print' tests and 'R: copy using cat-file' write blobs into the\nrepository of the trash directory, which all other tests share. 'R:\nprint two blobs to stdout' and 'R: copy using cat-file' also read the\n'big' file written by the preceding 'setup: big file' test, so they\ncan't run on their own.\n\nRun each of these tests in a new repository. Convert the setup test to a\n'setup_big_file()' function, which writes the file in the repository of\nthe calling test, and invoke it from both tests.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 428 ++++++++++++++++++++++++++++---------------------\n 1 file changed, 242 insertions(+), 186 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 04c3bfe0c1..3f0e7b8b1f 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2983,87 +2983,117 @@ test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n '\n \n test_expect_success !MINGW 'R: print old blob' '\n-\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 11\n-\tyes it can\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\techo \"cat-blob $blob\" |\n-\tgit fast-import --cat-blob-fd=6 6>actual &&\n-\ttest_cmp expect actual\n+\t\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 11\n+\t\tyes it can\n+\n+\t\tEOF\n+\t\techo \"cat-blob $blob\" |\n+\t\tgit fast-import --cat-blob-fd=6 6>actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n-\techo hello >greeting &&\n-\tblob=$(git hash-object -w greeting) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 6\n-\thello\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n-\tcat-blob $blob\n-\tEOF\n-\ttest_cmp expect actual.3 &&\n-\ttest_must_be_empty actual.1 &&\n-\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n-\toption cat-blob-fd=3\n-\tcat-blob $blob\n-\tEOF\n-\ttest_must_be_empty actual.3 &&\n-\ttest_cmp expect actual.1\n+\t\techo hello >greeting &&\n+\t\tblob=$(git hash-object -w greeting) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 6\n+\t\thello\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual.3 &&\n+\t\ttest_must_be_empty actual.1 &&\n+\t\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n+\t\toption cat-blob-fd=3\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_must_be_empty actual.3 &&\n+\t\ttest_cmp expect actual.1\n+\t)\n '\n \n test_expect_success !MINGW 'R: print mark for new blob' '\n-\techo \"effluentish\" | git hash-object --stdin >expect &&\n-\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata <<BLOB_END\n-\teffluentish\n-\tBLOB_END\n-\tget-mark :1\n-\tEOF\n-\ttest_cmp expect actual\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"effluentish\" | git hash-object --stdin >expect &&\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\teffluentish\n+\t\tBLOB_END\n+\t\tget-mark :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success !MINGW 'R: print new blob' '\n-\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 12\n-\tyep yep yep\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata <<BLOB_END\n-\tyep yep yep\n-\tBLOB_END\n-\tcat-blob :1\n-\tEOF\n-\ttest_cmp expect actual\n+\t\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 12\n+\t\tyep yep yep\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\tyep yep yep\n+\t\tBLOB_END\n+\t\tcat-blob :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success !MINGW 'R: print new blob by sha1' '\n-\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 25\n-\ta new blob named by sha1\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n-\tblob\n-\tdata <<BLOB_END\n-\ta new blob named by sha1\n-\tBLOB_END\n-\tcat-blob $blob\n-\tEOF\n-\ttest_cmp expect actual\n+\t\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 25\n+\t\ta new blob named by sha1\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n+\t\tblob\n+\t\tdata <<BLOB_END\n+\t\ta new blob named by sha1\n+\t\tBLOB_END\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n-test_expect_success 'setup: big file' '\n+setup_big_file () {\n \t(\n \t\techo \"the quick brown fox jumps over the lazy dog\" >big &&\n \t\tfor i in 1 2 3\n@@ -3073,153 +3103,179 @@ test_expect_success 'setup: big file' '\n \t\t\texit\n \t\tdone\n \t)\n-'\n+}\n \n test_expect_success 'R: print two blobs to stdout' '\n-\tblob1=$(git hash-object big) &&\n-\tblob1_len=$(wc -c <big) &&\n-\tblob2=$(echo hello | git hash-object --stdin) &&\n-\t{\n-\t\techo ${blob1} blob $blob1_len &&\n-\t\tcat big &&\n-\t\tcat <<-EOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\t\t${blob2} blob 6\n-\t\thello\n+\t\tsetup_big_file &&\n+\t\tblob1=$(git hash-object big) &&\n+\t\tblob1_len=$(wc -c <big) &&\n+\t\tblob2=$(echo hello | git hash-object --stdin) &&\n+\t\t{\n+\t\t\techo ${blob1} blob $blob1_len &&\n+\t\t\tcat big &&\n+\t\t\tcat <<-EOF\n \n-\t\tEOF\n-\t} >expect &&\n-\t{\n-\t\tcat <<-\\END_PART1 &&\n-\t\t\tblob\n-\t\t\tmark :1\n-\t\t\tdata <<data_end\n-\t\tEND_PART1\n-\t\tcat big &&\n-\t\tcat <<-\\EOF\n-\t\t\tdata_end\n-\t\t\tblob\n-\t\t\tmark :2\n-\t\t\tdata <<data_end\n+\t\t\t${blob2} blob 6\n \t\t\thello\n-\t\t\tdata_end\n-\t\t\tcat-blob :1\n-\t\t\tcat-blob :2\n-\t\tEOF\n-\t} |\n-\tgit fast-import >actual &&\n-\ttest_cmp expect actual\n+\n+\t\t\tEOF\n+\t\t} >expect &&\n+\t\t{\n+\t\t\tcat <<-\\END_PART1 &&\n+\t\t\t\tblob\n+\t\t\t\tmark :1\n+\t\t\t\tdata <<data_end\n+\t\t\tEND_PART1\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF\n+\t\t\t\tdata_end\n+\t\t\t\tblob\n+\t\t\t\tmark :2\n+\t\t\t\tdata <<data_end\n+\t\t\t\thello\n+\t\t\t\tdata_end\n+\t\t\t\tcat-blob :1\n+\t\t\t\tcat-blob :2\n+\t\t\tEOF\n+\t\t} |\n+\t\tgit fast-import >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success PIPE 'R: copy using cat-file' '\n-\texpect_id=$(git hash-object big) &&\n-\texpect_len=$(wc -c <big) &&\n-\techo $expect_id blob $expect_len >expect.response &&\n-\n-\trm -f blobs &&\n-\n-\tmkfifo blobs &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n-\t\tcat <<-\\EOF &&\n-\t\tfeature cat-blob\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB\n-\t\tEOF\n-\t\tcat big &&\n-\t\tcat <<-\\EOF &&\n-\t\tBLOB\n-\t\tcat-blob :1\n-\t\tEOF\n+\t\tcd repo &&\n \n-\t\tread blob_id type size <&3 &&\n-\t\techo \"$blob_id $type $size\" >response &&\n-\t\ttest_copy_bytes $size >blob <&3 &&\n-\t\tread newline <&3 &&\n+\t\tsetup_big_file &&\n+\t\texpect_id=$(git hash-object big) &&\n+\t\texpect_len=$(wc -c <big) &&\n+\t\techo $expect_id blob $expect_len >expect.response &&\n \n-\t\tcat <<-EOF &&\n-\t\tcommit refs/heads/copied\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcopy big file as file3\n-\t\tCOMMIT\n-\t\tM 644 inline file3\n-\t\tdata <<BLOB\n-\t\tEOF\n-\t\tcat blob &&\n-\t\techo BLOB\n-\t) 3<blobs |\n-\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\tgit show copied:file3 >actual &&\n-\ttest_cmp expect.response response &&\n-\ttest_cmp big actual\n+\t\trm -f blobs &&\n+\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tBLOB\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\techo \"$blob_id $type $size\" >response &&\n+\t\t\ttest_copy_bytes $size >blob <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\tcat <<-EOF &&\n+\t\t\tcommit refs/heads/copied\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tcopy big file as file3\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline file3\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat blob &&\n+\t\t\techo BLOB\n+\t\t) 3<blobs |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\tgit show copied:file3 >actual &&\n+\t\ttest_cmp expect.response response &&\n+\t\ttest_cmp big actual\n+\t)\n '\n \n test_expect_success PIPE 'R: print blob mid-commit' '\n-\trm -f blobs &&\n-\techo \"A blob from _before_ the commit.\" >expect &&\n-\tmkfifo blobs &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\texec 3<blobs &&\n-\t\tcat <<-EOF &&\n-\t\tfeature cat-blob\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB\n-\t\tA blob from _before_ the commit.\n-\t\tBLOB\n-\t\tcommit refs/heads/temporary\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tEmpty commit\n-\t\tCOMMIT\n-\t\tcat-blob :1\n-\t\tEOF\n+\t\tcd repo &&\n \n-\t\tread blob_id type size <&3 &&\n-\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\tread newline <&3 &&\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _before_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _before_ the commit.\n+\t\t\tBLOB\n+\t\t\tcommit refs/heads/temporary\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n \n-\t\techo\n-\t) |\n-\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\ttest_cmp expect actual\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success PIPE 'R: print staged blob within commit' '\n-\trm -f blobs &&\n-\techo \"A blob from _within_ the commit.\" >expect &&\n-\tmkfifo blobs &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\texec 3<blobs &&\n-\t\tcat <<-EOF &&\n-\t\tfeature cat-blob\n-\t\tcommit refs/heads/within\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tEmpty commit\n-\t\tCOMMIT\n-\t\tM 644 inline within\n-\t\tdata <<BLOB\n-\t\tA blob from _within_ the commit.\n-\t\tBLOB\n-\t\tEOF\n+\t\tcd repo &&\n \n-\t\tto_get=$(\n-\t\t\techo \"A blob from _within_ the commit.\" |\n-\t\t\tgit hash-object --stdin\n-\t\t) &&\n-\t\techo \"cat-blob $to_get\" &&\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _within_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tcommit refs/heads/within\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline within\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _within_ the commit.\n+\t\t\tBLOB\n+\t\t\tEOF\n \n-\t\tread blob_id type size <&3 &&\n-\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\tread newline <&3 &&\n+\t\t\tto_get=$(\n+\t\t\t\techo \"A blob from _within_ the commit.\" |\n+\t\t\t\tgit hash-object --stdin\n+\t\t\t) &&\n+\t\t\techo \"cat-blob $to_get\" &&\n \n-\t\techo deleteall\n-\t) |\n-\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\ttest_cmp expect actual\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo deleteall\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'R: quiet option results in no stats being output' '\n\n-- \n2.56.GIT\n\n\n"},{"id":"558070","messageId":"20261110-kn-fast-import-tests-1-v1-16-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 16/20] t9300: make the feature and option tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:50:01Z","receivedAt":"2026-11-10T11:50:01Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series R' which\ncheck the 'feature' command and the command line options to make them\nindependent of state from previous tests.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 188 +++++++++++++++++++++++++++++++++++--------------\n 1 file changed, 136 insertions(+), 52 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 3f0e7b8b1f..cf00e4faf9 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2607,54 +2607,90 @@ test_expect_success 'Q: deny note on empty branch' '\n ###\n \n test_expect_success 'R: abort on unsupported feature' '\n-\tcat >input <<-EOF &&\n-\tfeature no-such-feature-exists\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\tfeature no-such-feature-exists\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: supported feature is accepted' '\n-\tcat >input <<-EOF &&\n-\tfeature date-format=now\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n '\n \n test_expect_success 'R: abort on receiving feature after data command' '\n-\tcat >input <<-EOF &&\n-\tblob\n-\tdata 3\n-\thi\n-\tfeature date-format=now\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: import-marks features forbidden by default' '\n-\t>git.marks &&\n-\techo \"feature import-marks=git.marks\" >input &&\n-\ttest_must_fail git fast-import <input &&\n-\techo \"feature import-marks-if-exists=git.marks\" >input &&\n-\ttest_must_fail git fast-import <input\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t>git.marks &&\n+\t\techo \"feature import-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input &&\n+\t\techo \"feature import-marks-if-exists=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: only one import-marks feature allowed per stream' '\n-\t>git.marks &&\n-\t>git2.marks &&\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=git.marks\n-\tfeature import-marks=git2.marks\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import --allow-unsafe-features <input\n+\t\t>git.marks &&\n+\t\t>git2.marks &&\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=git.marks\n+\t\tfeature import-marks=git2.marks\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --allow-unsafe-features <input\n+\t)\n '\n \n test_expect_success 'R: export-marks feature forbidden by default' '\n-\techo \"feature export-marks=git.marks\" >input &&\n-\ttest_must_fail git fast-import <input\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature export-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: export-marks feature results in a marks file being created' '\n@@ -2969,17 +3005,35 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '\n \n \n test_expect_success 'R: feature ls supported' '\n-\techo \"feature ls\" |\n-\tgit fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature ls\" |\n+\t\tgit fast-import\n+\t)\n '\n \n test_expect_success 'R: feature cat-blob supported' '\n-\techo \"feature cat-blob\" |\n-\tgit fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature cat-blob\" |\n+\t\tgit fast-import\n+\t)\n '\n \n test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n-\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n+\t)\n '\n \n test_expect_success !MINGW 'R: print old blob' '\n@@ -3334,38 +3388,68 @@ test_expect_success 'R: terminating \"done\" within commit' '\n '\n \n test_expect_success 'R: die on unknown option' '\n-\tcat >input <<-EOF &&\n-\toption git non-existing-option\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\toption git non-existing-option\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: unknown commandline options are rejected' '\\\n-\ttest_must_fail git fast-import --non-existing-option < /dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --non-existing-option < /dev/null\n+\t)\n '\n \n test_expect_success 'R: feature-only names are rejected on the command line' '\n-\tfor opt in --alias --get-mark --ls --notes\n-\tdo\n-\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n-\tdone\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfor opt in --alias --get-mark --ls --notes\n+\t\tdo\n+\t\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n+\t\tdone\n+\t)\n '\n \n test_expect_success 'R: die on invalid option argument' '\n-\techo \"option git active-branches=-5\" |\n-\ttest_must_fail git fast-import &&\n-\techo \"option git depth=\" |\n-\ttest_must_fail git fast-import &&\n-\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"option git active-branches=-5\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\techo \"option git depth=\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n+\t)\n '\n \n test_expect_success 'R: ignore non-git options' '\n-\tcat >input <<-EOF &&\n-\toption non-existing-vcs non-existing-option\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\toption non-existing-vcs non-existing-option\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n '\n \n test_expect_success 'R: corrupt lines do not mess marks file' '\n\n-- \n2.56.GIT\n\n\n"},{"id":"558071","messageId":"20261110-kn-fast-import-tests-1-v1-17-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 17/20] t9300: make the stream tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:50:02Z","receivedAt":"2026-11-10T11:50:02Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series R' which\ncheck empty and truncated streams, the 'quiet' option and the 'done'\nfeature to make them independent of state from previous tests.\n\n'empty stream succeeds' no longer needs to configure\n'fastimport.unpackLimit', as that was moved to the first test needing it\nby an earlier commit.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 122 ++++++++++++++++++++++++++++++++-----------------\n 1 file changed, 79 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex cf00e4faf9..c719b2115e 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -38,11 +38,23 @@ echo \"$@\"'\n ###\n \n test_expect_success 'empty stream succeeds' '\n-\tgit fast-import </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import </dev/null\n+\t)\n '\n \n test_expect_success 'truncated stream complains' '\n-\techo \"tag foo\" | test_must_fail git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"tag foo\" | test_must_fail git fast-import\n+\t)\n '\n \n test_expect_success 'A: create pack from stdin' '\n@@ -3333,58 +3345,82 @@ test_expect_success PIPE 'R: print staged blob within commit' '\n '\n \n test_expect_success 'R: quiet option results in no stats being output' '\n-\tcat >input <<-EOF &&\n-\toption git quiet\n-\tblob\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n+\t\tcat >input <<-EOF &&\n+\t\toption git quiet\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n \n-\tgit fast-import 2>output <input &&\n-\ttest_must_be_empty output\n+\t\tEOF\n+\n+\t\tgit fast-import 2>output <input &&\n+\t\ttest_must_be_empty output\n+\t)\n '\n \n test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n-\techo feature done | test_must_fail git fast-import &&\n-\ttest_must_fail git fast-import --done </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo feature done | test_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --done </dev/null\n+\t)\n '\n \n test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n-\tgit fast-import <<-\\EOF &&\n-\tfeature done\n-\tdone\n-\ttrailing gibberish\n-\tEOF\n-\tgit fast-import <<-\\EOF\n-\tdone\n-\tmore trailing gibberish\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import <<-\\EOF &&\n+\t\tfeature done\n+\t\tdone\n+\t\ttrailing gibberish\n+\t\tEOF\n+\t\tgit fast-import <<-\\EOF\n+\t\tdone\n+\t\tmore trailing gibberish\n+\t\tEOF\n+\t)\n '\n \n test_expect_success 'R: terminating \"done\" within commit' '\n-\tcat >expect <<-\\EOF &&\n-\tOBJID\n-\t:000000 100644 OBJID OBJID A\thello.c\n-\t:000000 100644 OBJID OBJID A\thello2.c\n-\tEOF\n-\tgit fast-import <<-EOF &&\n-\tcommit refs/heads/done-ends\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<EOT\n-\tCommit terminated by \"done\" command\n-\tEOT\n-\tM 100644 inline hello.c\n-\tdata <<EOT\n-\tHello, world.\n-\tEOT\n-\tC hello.c hello2.c\n-\tdone\n-\tEOF\n-\tgit rev-list done-ends |\n-\tgit diff-tree -r --stdin --root --always |\n-\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n-\ttest_cmp expect actual\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >expect <<-\\EOF &&\n+\t\tOBJID\n+\t\t:000000 100644 OBJID OBJID A\thello.c\n+\t\t:000000 100644 OBJID OBJID A\thello2.c\n+\t\tEOF\n+\t\tgit fast-import <<-EOF &&\n+\t\tcommit refs/heads/done-ends\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<EOT\n+\t\tCommit terminated by \"done\" command\n+\t\tEOT\n+\t\tM 100644 inline hello.c\n+\t\tdata <<EOT\n+\t\tHello, world.\n+\t\tEOT\n+\t\tC hello.c hello2.c\n+\t\tdone\n+\t\tEOF\n+\t\tgit rev-list done-ends |\n+\t\tgit diff-tree -r --stdin --root --always |\n+\t\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'R: die on unknown option' '\n\n-- \n2.56.GIT\n\n\n"},{"id":"558072","messageId":"20261110-kn-fast-import-tests-1-v1-18-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 18/20] t9300: make the get-mark and encoding tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:50:03Z","receivedAt":"2026-11-10T11:50:03Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series W' and 'X:\nhandling encoding' to make them independent of state from previous\ntests.\n\nThe 'W' tests read the 'W-input' file written at the top level of the\nscript, which is not in the new repository. Turn it into a 'w_input()'\nfunction which prints the stream.\n\n'X: replace ref that becomes useless is removed' changes its working\ndirectory and doesn't change back, so the tests after it, run in that\nrepository. Move the 'cd' into the subshell, and cleanup when the test\ncompletes.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 81 +++++++++++++++++++++++++++++++++++---------------\n 1 file changed, 57 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex c719b2115e..09cd2c5bf3 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -4503,7 +4503,8 @@ test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n ### series W (get-mark and empty orphan commits)\n ###\n \n-cat >>W-input <<-W_INPUT_END\n+w_input () {\n+\tcat <<-W_INPUT_END\n \tcommit refs/heads/W-branch\n \tmark :1\n \tauthor Full Name <user@company.tld> 1000000000 +0100\n@@ -4512,28 +4513,53 @@ cat >>W-input <<-W_INPUT_END\n \tIntentionally empty commit\n \tLFsget-mark :1\n \tW_INPUT_END\n+}\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n-\tsed -e s/LFs// W-input | tr L \"\\n\" | git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs// | tr L \"\\n\" | git fast-import\n+\t)\n '\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n-\tsed -e s/LFs/L/ W-input | tr L \"\\n\" | git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs/L/ | tr L \"\\n\" | git fast-import\n+\t)\n '\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n-\t# Technically, this should fail as it has too many linefeeds\n-\t# according to the grammar in fast-import.txt.  But, for whatever\n-\t# reason, it works.  Since using the correct number of newlines\n-\t# does not work with older (pre-2.22) versions of git, allow apps\n-\t# that used this second-newline workaround to keep working by\n-\t# checking it with this test...\n-\tsed -e s/LFs/LL/ W-input | tr L \"\\n\" | git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# Technically, this should fail as it has too many linefeeds\n+\t\t# according to the grammar in fast-import.txt.  But, for whatever\n+\t\t# reason, it works.  Since using the correct number of newlines\n+\t\t# does not work with older (pre-2.22) versions of git, allow apps\n+\t\t# that used this second-newline workaround to keep working by\n+\t\t# checking it with this test...\n+\t\tw_input | sed -e s/LFs/LL/ | tr L \"\\n\" | git fast-import\n+\t)\n '\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n-\t# ...but do NOT allow more empty lines than that (see previous test).\n-\tsed -e s/LFs/LLL/ W-input | tr L \"\\n\" | test_must_fail git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# ...but do NOT allow more empty lines than that (see previous test).\n+\t\tw_input | sed -e s/LFs/LLL/ | tr L \"\\n\" | test_must_fail git fast-import\n+\t)\n '\n \n ###\n@@ -4541,25 +4567,32 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous thi\n ###\n \n test_expect_success ICONV 'X: handling encoding' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/encoding\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tencoding iso-8859-7\n-\tdata <<COMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/encoding\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tencoding iso-8859-7\n+\t\tdata <<COMMIT\n+\t\tINPUT_END\n \n-\tgit fast-import <input &&\n-\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n-\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n+\t\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n+\n+\t\tgit fast-import <input &&\n+\t\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n+\t\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n+\t)\n '\n \n test_expect_success 'X: replace ref that becomes useless is removed' '\n+\ttest_when_finished \"rm -rf testrepo\" &&\n \tgit init -qb main testrepo &&\n-\tcd testrepo &&\n \t(\n+\t\tcd testrepo &&\n \t\ttest_commit test &&\n \n \t\ttest_commit msg somename content &&\n\n-- \n2.56.GIT\n\n\n"},{"id":"558073","messageId":"20261110-kn-fast-import-tests-1-v1-19-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 19/20] t9300: move self-contained tests into dedicated files","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:50:04Z","receivedAt":"2026-11-10T11:50:04Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The previous commits worked on making most of the tests within t9300\nindependent from each other. Now we can move them, as they are, to\nother files based on what they exercise. Create some new test files:\n\n  - t9307-fast-import-validation\n  - t9308-fast-import-stream\n  - t9309-fast-import-checkpoint\n  - t9310-fast-import-submodule\n  - t9311-fast-import-refs\n\nand move the others to existing test files:\n\n  - t9301-fast-import-notes\n  - t9304-fast-import-marks\n\nRegister the new test files in t/meson.build.\n\nThe series 'A', 'C', 'D', 'H', 'L', 'M', 'N' and 'U' stay in t9300, as\nthey still depend on each other. The tests are moved without changes,\nwhich can be checked with 'git show --color-moved'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/meson.build                     |    5 +\n t/t9300-fast-import.sh            | 3565 -------------------------------------\n t/t9301-fast-import-notes.sh      |  411 +++++\n t/t9304-fast-import-marks.sh      |  393 ++++\n t/t9307-fast-import-validation.sh | 1193 +++++++++++++\n t/t9308-fast-import-stream.sh     |  822 +++++++++\n t/t9309-fast-import-checkpoint.sh |  188 ++\n t/t9310-fast-import-submodule.sh  |  341 ++++\n t/t9311-fast-import-refs.sh       |  194 ++\n 9 files changed, 3547 insertions(+), 3565 deletions(-)\n\ndiff --git a/t/meson.build b/t/meson.build\nindex 11b3752f00..caf0a76c2d 100644\n--- a/t/meson.build\n+++ b/t/meson.build\n@@ -1084,6 +1084,11 @@ integration_tests = [\n   't9304-fast-import-marks.sh',\n   't9305-fast-import-signatures.sh',\n   't9306-fast-import-signed-tags.sh',\n+  't9307-fast-import-validation.sh',\n+  't9308-fast-import-stream.sh',\n+  't9309-fast-import-checkpoint.sh',\n+  't9310-fast-import-submodule.sh',\n+  't9311-fast-import-refs.sh',\n   't9350-fast-export.sh',\n   't9351-fast-export-anonymize.sh',\n   't9400-git-cvsserver-server.sh',\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 09cd2c5bf3..48c2913b87 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -37,26 +37,6 @@ echo \"$@\"'\n ### series A\n ###\n \n-test_expect_success 'empty stream succeeds' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit fast-import </dev/null\n-\t)\n-'\n-\n-test_expect_success 'truncated stream complains' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"tag foo\" | test_must_fail git fast-import\n-\t)\n-'\n-\n test_expect_success 'A: create pack from stdin' '\n \tgit config fastimport.unpackLimit 0 &&\n \ttest_tick &&\n@@ -309,421 +289,6 @@ test_expect_success 'A: verify diff' '\n \t    = $(git rev-parse --verify verify--import-marks:copy-of-file2)\n '\n \n-test_expect_success 'A: export marks with large values' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_tick &&\n-\t\tmt=$(git hash-object --stdin < /dev/null) &&\n-\t\t>input.blob &&\n-\t\t>marks.exp &&\n-\t\t>tree.exp &&\n-\n-\t\tcat >input.commit <<-EOF &&\n-\t\tcommit refs/heads/verify--dump-marks\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\ttest the sparse array dumping routines with exponentially growing marks\n-\t\tCOMMIT\n-\t\tEOF\n-\n-\t\ti=0 l=4 m=6 n=7 &&\n-\t\twhile test \"$i\" -lt 27\n-\t\tdo\n-\t\t\tcat >>input.blob <<-EOF &&\n-\t\t\tblob\n-\t\t\tmark :$l\n-\t\t\tdata 0\n-\t\t\tblob\n-\t\t\tmark :$m\n-\t\t\tdata 0\n-\t\t\tblob\n-\t\t\tmark :$n\n-\t\t\tdata 0\n-\t\t\tEOF\n-\t\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n-\t\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n-\t\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n-\n-\t\t\techo \":$l $mt\" >>marks.exp &&\n-\t\t\techo \":$m $mt\" >>marks.exp &&\n-\t\t\techo \":$n $mt\" >>marks.exp &&\n-\n-\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n-\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n-\t\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n-\n-\t\t\tl=$(($l + $l)) &&\n-\t\t\tm=$(($m + $m)) &&\n-\t\t\tn=$(($l + $n)) &&\n-\n-\t\t\ti=$((1 + $i)) || return 1\n-\t\tdone &&\n-\n-\t\tsort tree.exp > tree.exp_s &&\n-\n-\t\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n-\t\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n-\t\ttest_cmp tree.exp_s tree.out &&\n-\t\ttest_cmp marks.exp marks.large\n-\t)\n-'\n-\n-###\n-### series B\n-###\n-\n-test_expect_success 'B: fail on invalid blob sha1' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit base &&\n-\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/branch\n-\t\tmark :1\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcorrupt\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\t\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit new &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit TEMP_TAG\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\ttag base\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n-\t\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n-\t)\n-'\n-\n-test_expect_success 'B: accept empty committer' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/empty-committer-1\n-\t\tcommitter  <> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tout=$(git fsck) &&\n-\t\techo \"$out\" &&\n-\t\ttest -z \"$out\"\n-\t)\n-'\n-\n-test_expect_success 'B: reject invalid timezone' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-timezone\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: accept invalid timezone with raw-permissive' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-timezone\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\tgit fast-import --date-format=raw-permissive <input &&\n-\t\tgit cat-file -p invalid-timezone >out &&\n-\t\ttest_grep \"1234567890 [+]051800\" out\n-\t)\n-'\n-\n-test_expect_success 'B: accept and fixup committer with no name' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/empty-committer-2\n-\t\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tout=$(git fsck) &&\n-\t\techo \"$out\" &&\n-\t\ttest -z \"$out\"\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (1)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (2)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (3)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name <email>> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (4)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name <email $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (5)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name<email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of ..' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 100644 :1 ../invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of .' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tGood path\n-\t\tCOMMIT\n-\t\tM 100644 :1 ok-path\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tBad path\n-\t\tCOMMIT\n-\t\tR ok-path ./invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 100644 :1 C:/invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of .git' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 100644 :1 .git/invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of .gitmodules' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 120000 :1 .gitmodules\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n ###\n ### series C\n ###\n@@ -841,155 +406,6 @@ test_expect_success 'D: verify file6' '\n \ttest_cmp expect actual\n '\n \n-###\n-### series E\n-###\n-\n-test_expect_success 'E: rfc2822 date, --date-format=raw' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n-\t\tdata <<COMMIT\n-\t\tRFC 2822 type date\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main^0\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import --date-format=raw <input\n-\t)\n-'\n-\n-test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n-\t\tdata <<COMMIT\n-\t\tRFC 2822 type date\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main^0\n-\n-\t\tINPUT_END\n-\n-\t\tgit -c fastimport.unpackLimit=0 fast-import --date-format=rfc2822 <input &&\n-\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n-\n-\t\tRFC 2822 type date\n-\t\tEOF\n-\t\tgit cat-file commit main | sed 1,2d >actual &&\n-\t\ttest_cmp expect actual &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack \"$p\" || return 1\n-\t\tdone\n-\t)\n-'\n-\n-###\n-### series F\n-###\n-\n-setup_two_commit_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_commit -C repo one &&\n-\ttest_commit -C repo two\n-}\n-\n-test_expect_success 'F: non-fast-forward update skips' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\told_branch=$(git rev-parse --verify main^0) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tlosing things already?\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main~1\n-\n-\t\treset refs/heads/other\n-\t\tfrom refs/heads/main\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git -c fastimport.unpackLimit=0 fast-import <input &&\n-\t\t# branch must remain unaffected\n-\t\ttest $old_branch = $(git rev-parse --verify main^0) &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack \"$p\" || return 1\n-\t\tdone &&\n-\n-\t\tcat >expect <<-EOF &&\n-\t\ttree $(git rev-parse main~1^{tree})\n-\t\tparent $(git rev-parse main~1)\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tlosing things already?\n-\t\tEOF\n-\t\tgit cat-file commit other >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-###\n-### series G\n-###\n-\n-test_expect_success 'G: non-fast-forward update forced' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\told_branch=$(git rev-parse --verify main^0) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tlosing things already?\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main~1\n-\n-\t\tINPUT_END\n-\t\tgit -c fastimport.unpackLimit=0 fast-import --force <input &&\n-\t\t# branch changed, but logged\n-\t\ttest $old_branch != $(git rev-parse --verify main^0) &&\n-\t\ttest $old_branch = $(git rev-parse --verify main@{1}) &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack \"$p\" || return 1\n-\t\tdone\n-\t)\n-'\n-\n ###\n ### series H\n ###\n@@ -1043,123 +459,6 @@ test_expect_success 'H: verify file' '\n \ttest_cmp expect actual\n '\n \n-###\n-### series I\n-###\n-\n-test_expect_success 'I: export-pack-edges' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init -b main repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/export-boundary\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\twe have a border.  its only 40 characters wide.\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\tINPUT_END\n-\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n-\t\t\t--export-pack-edges=edges.list <input &&\n-\n-\t\t# verify edge list\n-\t\tcat >expect <<-EOF &&\n-\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n-\t\tEOF\n-\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-###\n-### series J\n-###\n-\n-test_expect_success 'J: reset existing branch creates empty commit' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/J\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcreate J\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\treset refs/heads/J\n-\n-\t\tcommit refs/heads/J\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tinitialize J\n-\t\tCOMMIT\n-\n-\t\tINPUT_END\n-\t\tgit fast-import <input &&\n-\t\t# branch has 1 commit, empty tree\n-\t\ttest 1 = $(git rev-list J | wc -l) &&\n-\t\ttest 0 = $(git ls-tree J | wc -l)\n-\t)\n-'\n-\n-test_expect_success 'J: tag must fail on empty branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\treset refs/heads/J2\n-\n-\t\ttag wrong_tag\n-\t\tfrom refs/heads/J2\n-\t\tdata <<EOF\n-\t\tTag branch that was reset.\n-\t\tEOF\n-\t\tINPUT_END\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-###\n-### series K\n-###\n-\n-test_expect_success 'K: reinit branch with from' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/K\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcreate K\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\tcommit refs/heads/K\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tredo K\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main^1\n-\n-\t\tINPUT_END\n-\t\tgit fast-import <input &&\n-\t\t# K^1 = main^1\n-\t\ttest $(git rev-parse --verify main^1) \\\n-\t\t\t= $(git rev-parse --verify K^1)\n-\t)\n-'\n-\n ###\n ### series L\n ###\n@@ -1794,2418 +1093,6 @@ do\n \t'\n done\n \n-###\n-### series O\n-###\n-\n-setup_import_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\tgit -C repo config fastimport.unpackLimit 0 &&\n-\tmkdir repo/file2 &&\n-\techo abcd >repo/file2/file4 &&\n-\tgit -C repo add file2/file4 &&\n-\ttest_tick &&\n-\tgit -C repo commit -m base\n-}\n-\n-import_reference_commit () {\n-\tgit fast-import <<-INPUT_END\n-\tcommit refs/heads/$1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tdirty directory copy\n-\tCOMMIT\n-\n-\tfrom refs/heads/main\n-\tM 644 inline file2/file5\n-\tdata <<EOF\n-\tan inline file.\n-\t  we should see it later.\n-\tEOF\n-\n-\tC file2 file3\n-\tD file2/file5\n-\n-\tINPUT_END\n-}\n-\n-test_expect_success 'O: comments are all skipped' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\t#we will\n-\t\tcommit refs/heads/O1\n-\t\t# -- ignore all of this text\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tdirty directory copy\n-\t\tCOMMIT\n-\n-\t\t# do not forget the import blank line!\n-\t\t#\n-\t\t# yes, we started from our usual base of main.\n-\t\t# i like main.\n-\t\tfrom refs/heads/main\n-\t\t# and we need to add file2/file5 to file2.\n-\t\tM 644 inline file2/file5\n-\t\t# otherwise the tree will be different\n-\t\tdata <<EOF\n-\t\tan inline file.\n-\t\t  we should see it later.\n-\t\tEOF\n-\n-\t\t# do not forget to copy file2 to file3\n-\t\tC file2 file3\n-\t\t#\n-\t\t# or to delete file5 from file2.\n-\t\tD file2/file5\n-\t\t# are we done yet?\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n-\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t100644 blob $blob4\tfile2/file4\n-\t\t100644 blob $blob4\tfile3/file4\n-\t\t100644 blob $blob5\tfile3/file5\n-\t\tEOF\n-\t\tgit ls-tree -r O1 >actual &&\n-\t\ttest_cmp expect actual &&\n-\n-\t\timport_reference_commit O1-reference &&\n-\t\ttest_cmp_rev O1-reference O1\n-\t)\n-'\n-\n-test_expect_success 'O: blank lines not necessary after data commands' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/O2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tdirty directory copy\n-\t\tCOMMIT\n-\t\tfrom refs/heads/main\n-\t\tM 644 inline file2/file5\n-\t\tdata <<EOF\n-\t\tan inline file.\n-\t\t  we should see it later.\n-\t\tEOF\n-\t\tC file2 file3\n-\t\tD file2/file5\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n-\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t100644 blob $blob4\tfile2/file4\n-\t\t100644 blob $blob4\tfile3/file4\n-\t\t100644 blob $blob5\tfile3/file5\n-\t\tEOF\n-\t\tgit ls-tree -r O2 >actual &&\n-\t\ttest_cmp expect actual &&\n-\n-\t\timport_reference_commit O2-reference &&\n-\t\ttest_cmp_rev O2-reference O2\n-\t)\n-'\n-\n-test_expect_success 'O: blank lines not necessary after other commands' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tgit repack -a -d &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/O3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzstring\n-\t\tCOMMIT\n-\t\tcommit refs/heads/O3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzof\n-\t\tCOMMIT\n-\t\tcheckpoint\n-\t\tcommit refs/heads/O3\n-\t\tmark :5\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzempty\n-\t\tCOMMIT\n-\t\tcheckpoint\n-\t\tcommit refs/heads/O3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzcommits\n-\t\tCOMMIT\n-\t\treset refs/tags/O3-2nd\n-\t\tfrom :5\n-\t\treset refs/tags/O3-3rd\n-\t\tfrom :5\n-\t\tINPUT_END\n-\n-\t\tcat >expect <<-INPUT_END &&\n-\t\tstring\n-\t\tof\n-\t\tempty\n-\t\tcommits\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tls -la .git/objects/pack/pack-*.pack >packlist &&\n-\t\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n-\t\ttest_line_count = 4 idxlist &&\n-\t\ttest_line_count = 4 packlist &&\n-\t\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n-\t\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'O: progress outputs as requested by input' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzstring\n-\t\tCOMMIT\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzof\n-\t\tCOMMIT\n-\t\tprogress Two commits down, 2 to go!\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzempty\n-\t\tCOMMIT\n-\t\tprogress Three commits down, 1 to go!\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzcommits\n-\t\tCOMMIT\n-\t\tprogress done!\n-\t\tINPUT_END\n-\t\tgit fast-import <input >actual &&\n-\t\tgrep \"progress \" <input >expect &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-###\n-### series P (gitlinks)\n-###\n-\n-setup_gitlinks_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_commit -C repo base &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 10\n-\t\ttest file\n-\n-\t\treset refs/heads/sub\n-\t\tcommit refs/heads/sub\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 12\n-\t\tsub_initial\n-\t\tM 100644 :1 file\n-\n-\t\tblob\n-\t\tmark :3\n-\t\tdata <<DATAEND\n-\t\t[submodule \"sub\"]\n-\t\t\tpath = sub\n-\t\t\turl = \"$(pwd)/sub\"\n-\t\tDATAEND\n-\n-\t\tcommit refs/heads/subuse1\n-\t\tmark :4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 8\n-\t\tinitial\n-\t\tfrom refs/heads/main\n-\t\tM 100644 :3 .gitmodules\n-\t\tM 160000 :2 sub\n-\n-\t\tblob\n-\t\tmark :5\n-\t\tdata 20\n-\t\ttest file\n-\t\tmore data\n-\n-\t\tcommit refs/heads/sub\n-\t\tmark :6\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 11\n-\t\tsub_second\n-\t\tfrom :2\n-\t\tM 100644 :5 file\n-\n-\t\tcommit refs/heads/subuse1\n-\t\tmark :7\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 7\n-\t\tsecond\n-\t\tfrom :4\n-\t\tM 160000 :6 sub\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input\n-\t)\n-}\n-\n-test_expect_success 'P: superproject & submodule mix' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit checkout subuse1 &&\n-\t\trm -rf sub &&\n-\t\tmkdir sub &&\n-\t\t(\n-\t\t\tcd sub &&\n-\t\t\tgit init &&\n-\t\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n-\t\t\tgit checkout main\n-\t\t) &&\n-\t\tgit submodule init &&\n-\t\tgit submodule update\n-\t)\n-'\n-\n-test_expect_success 'P: verbatim SHA gitlinks' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tSUBLAST=$(git rev-parse --verify sub) &&\n-\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<DATAEND\n-\t\t[submodule \"sub\"]\n-\t\t\tpath = sub\n-\t\t\turl = \"$(pwd)/sub\"\n-\t\tDATAEND\n-\n-\t\tcommit refs/heads/subuse2\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 8\n-\t\tinitial\n-\t\tfrom refs/heads/main\n-\t\tM 100644 :1 .gitmodules\n-\t\tM 160000 $SUBPREV sub\n-\n-\t\tcommit refs/heads/subuse2\n-\t\tmark :3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 7\n-\t\tsecond\n-\t\tfrom :2\n-\t\tM 160000 $SUBLAST sub\n-\n-\t\tINPUT_END\n-\n-\t\tgit branch -D sub &&\n-\t\tgit gc --prune=now &&\n-\t\tgit fast-import <input &&\n-\t\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n-\t)\n-'\n-\n-test_expect_success 'P: fail on inline gitlink' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/subuse3\n-\t\tmark :1\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcorrupt\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/subuse1\n-\t\tM 160000 inline sub\n-\t\tdata <<DATA\n-\t\t$SUBPREV\n-\t\tDATA\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'P: fail on blob mark in gitlink' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<DATA\n-\t\t$SUBPREV\n-\t\tDATA\n-\n-\t\tcommit refs/heads/subuse3\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcorrupt\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/subuse1\n-\t\tM 160000 :1 sub\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-###\n-### series Q (notes)\n-###\n-\n-setup_notes_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\tfile2_data=\"file2\n-second line of EOF\" &&\n-\tfile4_data=abcd &&\n-\tfile4_len=4 &&\n-\tfile5_data=\"an inline file.\n-  we should see it later.\" &&\n-\tfile6_data=\"#!/bin/sh\n-echo \\\"\\$@\\\"\" &&\n-\tnote1_data=\"The first note for the first commit\" &&\n-\tnote2_data=\"The first note for the second commit\" &&\n-\tnote3_data=\"The first note for the third commit\" &&\n-\tnote1b_data=\"The second note for the first commit\" &&\n-\tnote1c_data=\"The third note for the first commit\" &&\n-\tnote2b_data=\"The second note for the second commit\" &&\n-\n-\ttest_tick &&\n-\tcat >repo/input <<-INPUT_END &&\n-\tblob\n-\tmark :2\n-\tdata <<EOF\n-\t$file2_data\n-\tEOF\n-\n-\tcommit refs/heads/notes-test\n-\tmark :3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tfirst (:3)\n-\tCOMMIT\n-\n-\tM 644 :2 file2\n-\n-\tblob\n-\tmark :4\n-\tdata $file4_len\n-\t$file4_data\n-\tcommit refs/heads/notes-test\n-\tmark :5\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tsecond (:5)\n-\tCOMMIT\n-\n-\tM 644 :4 file4\n-\n-\tcommit refs/heads/notes-test\n-\tmark :6\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tthird (:6)\n-\tCOMMIT\n-\n-\tM 644 inline file5\n-\tdata <<EOF\n-\t$file5_data\n-\tEOF\n-\n-\tM 755 inline file6\n-\tdata <<EOF\n-\t$file6_data\n-\tEOF\n-\n-\tblob\n-\tmark :7\n-\tdata <<EOF\n-\t$note1_data\n-\tEOF\n-\n-\tblob\n-\tmark :8\n-\tdata <<EOF\n-\t$note2_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar\n-\tmark :9\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:9)\n-\tCOMMIT\n-\n-\tN :7 :3\n-\tN :8 :5\n-\tN inline :6\n-\tdata <<EOF\n-\t$note3_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar\n-\tmark :10\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:10)\n-\tCOMMIT\n-\n-\tN inline :3\n-\tdata <<EOF\n-\t$note1b_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar2\n-\tmark :11\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:11)\n-\tCOMMIT\n-\n-\tN inline :3\n-\tdata <<EOF\n-\t$note1c_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar\n-\tmark :12\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:12)\n-\tCOMMIT\n-\n-\tdeleteall\n-\tN inline :5\n-\tdata <<EOF\n-\t$note2b_data\n-\tEOF\n-\n-\tINPUT_END\n-\n-\tgit -C repo -c fastimport.unpackLimit=0 fast-import <repo/input &&\n-\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n-\tcommit2=$(git -C repo rev-parse notes-test^) &&\n-\tcommit3=$(git -C repo rev-parse notes-test)\n-}\n-\n-test_expect_success 'Q: verify pack' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack \"$p\" || return 1\n-\t\tdone\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tfirst (:3)\n-\t\tEOF\n-\t\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $commit1\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tsecond (:5)\n-\t\tEOF\n-\t\tgit cat-file commit notes-test^ | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $commit2\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tthird (:6)\n-\t\tEOF\n-\t\tgit cat-file commit notes-test | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:9)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit1\n-\t\t100644 blob $commit2\n-\t\t100644 blob $commit3\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note1_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note2_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for third commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note3_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $(git rev-parse --verify refs/notes/foobar~2)\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:10)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit1\n-\t\t100644 blob $commit2\n-\t\t100644 blob $commit3\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second note for first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note1b_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note2_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for third commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note3_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:11)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit1\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third note for first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note1c_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify fourth notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $(git rev-parse --verify refs/notes/foobar^)\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:12)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify fourth notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit2\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second note for second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note2b_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: deny note on empty branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-EOF &&\n-\t\treset refs/heads/Q0\n-\n-\t\tcommit refs/heads/note-Q0\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tNote for an empty branch.\n-\t\tCOMMIT\n-\n-\t\tN inline refs/heads/Q0\n-\t\tdata <<NOTE\n-\t\tsome note\n-\t\tNOTE\n-\t\tEOF\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-###\n-### series R (feature and option)\n-###\n-\n-test_expect_success 'R: abort on unsupported feature' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature no-such-feature-exists\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: supported feature is accepted' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature date-format=now\n-\t\tEOF\n-\n-\t\tgit fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: abort on receiving feature after data command' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tblob\n-\t\tdata 3\n-\t\thi\n-\t\tfeature date-format=now\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: import-marks features forbidden by default' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t>git.marks &&\n-\t\techo \"feature import-marks=git.marks\" >input &&\n-\t\ttest_must_fail git fast-import <input &&\n-\t\techo \"feature import-marks-if-exists=git.marks\" >input &&\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: only one import-marks feature allowed per stream' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t>git.marks &&\n-\t\t>git2.marks &&\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=git.marks\n-\t\tfeature import-marks=git2.marks\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import --allow-unsafe-features <input\n-\t)\n-'\n-\n-test_expect_success 'R: export-marks feature forbidden by default' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature export-marks=git.marks\" >input &&\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: export-marks feature results in a marks file being created' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature export-marks=git.marks\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_grep :1 git.marks\n-\t)\n-'\n-\n-test_expect_success 'R: export-marks options can be overridden by commandline options' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-\\EOF &&\n-\t\tfeature export-marks=feature-sub/git.marks\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\tgit fast-import --allow-unsafe-features \\\n-\t\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n-\t\ttest_grep :1 cmdline-sub/other.marks &&\n-\t\ttest_path_is_missing feature-sub\n-\t)\n-'\n-\n-test_expect_success 'R: catch typo in marks file name' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n-\t\techo \"feature import-marks=nonexistent.marks\" |\n-\t\ttest_must_fail git fast-import --allow-unsafe-features\n-\t)\n-'\n-\n-test_expect_success 'R: import and output marks can be the same file' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\tblob=$(echo hi | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t:1 $blob\n-\t\t:2 $blob\n-\t\tEOF\n-\t\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n-\t\tblob\n-\t\tmark :2\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks\n-\t)\n-'\n-\n-test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t)\n-'\n-\n-test_expect_success 'R: --import-marks-if-exists' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\tblob=$(echo hi | git hash-object --stdin) &&\n-\t\techo \":1 $blob\" >expect &&\n-\t\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks\n-\t)\n-'\n-\n-test_expect_success 'R: feature import-marks-if-exists' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\n-\t\tgit fast-import --export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=not_io.marks\n-\t\tEOF\n-\t\ttest_must_be_empty io.marks &&\n-\n-\t\tblob=$(echo hi | git hash-object -w --stdin) &&\n-\n-\t\techo \":1 $blob\" >io.marks &&\n-\t\techo \":1 $blob\" >expect &&\n-\t\techo \":2 $blob\" >>expect &&\n-\n-\t\tgit fast-import --export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=io.marks\n-\t\tblob\n-\t\tmark :2\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks &&\n-\n-\t\techo \":3 $blob\" >>expect &&\n-\n-\t\tgit fast-import --import-marks=io.marks \\\n-\t\t\t\t--export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=not_io.marks\n-\t\tblob\n-\t\tmark :3\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks &&\n-\n-\t\tgit fast-import --import-marks-if-exists=not_io.marks \\\n-\t\t\t\t--export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=io.marks\n-\t\tEOF\n-\t\ttest_must_be_empty io.marks\n-\t)\n-'\n-\n-create_marks_file () {\n-\tgit fast-import --export-marks=\"$1\" <<-EOF\n-\tblob\n-\tmark :1\n-\tdata 4\n-\tone\n-\n-\tblob\n-\tmark :2\n-\tdata 4\n-\ttwo\n-\n-\tblob\n-\tmark :3\n-\tdata 6\n-\tthree\n-\n-\tblob\n-\tmark :4\n-\tdata 5\n-\tfour\n-\n-\tcommit refs/heads/marks\n-\tmark :5\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit with a mark\n-\tCOMMIT\n-\tM 100644 :1 one\n-\n-\ttag marks-tag\n-\tmark :6\n-\tfrom :5\n-\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<TAG\n-\ttag with a mark\n-\tTAG\n-\n-\tEOF\n-}\n-\n-test_expect_success 'R: import to output marks works without any content' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=marks.out\n-\t\tfeature export-marks=marks.new\n-\t\tEOF\n-\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out marks.new\n-\t)\n-'\n-\n-test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=nonexistent.marks\n-\t\tfeature export-marks=marks.new\n-\t\tEOF\n-\n-\t\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out marks.new\n-\t)\n-'\n-\n-test_expect_success 'R: multiple --import-marks= should be honoured' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=nonexistent.marks\n-\t\tfeature export-marks=combined.marks\n-\t\tEOF\n-\n-\t\thead -n2 marks.out >one.marks &&\n-\t\ttail -n +3 marks.out >two.marks &&\n-\t\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n-\t\t\t--allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out combined.marks\n-\t)\n-'\n-\n-test_expect_success 'R: feature relative-marks should be honoured' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature relative-marks\n-\t\tfeature import-marks=relative.in\n-\t\tfeature export-marks=relative.out\n-\t\tEOF\n-\n-\t\tmkdir -p .git/info/fast-import/ &&\n-\t\tcp marks.out .git/info/fast-import/relative.in &&\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out .git/info/fast-import/relative.out\n-\t)\n-'\n-\n-test_expect_success 'R: feature no-relative-marks should be honoured' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature relative-marks\n-\t\tfeature import-marks=relative.in\n-\t\tfeature no-relative-marks\n-\t\tfeature export-marks=non-relative.out\n-\t\tEOF\n-\n-\t\tmkdir -p .git/info/fast-import/ &&\n-\t\tcp marks.out .git/info/fast-import/relative.in &&\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out non-relative.out\n-\t)\n-'\n-\n-\n-test_expect_success 'R: feature ls supported' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature ls\" |\n-\t\tgit fast-import\n-\t)\n-'\n-\n-test_expect_success 'R: feature cat-blob supported' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature cat-blob\" |\n-\t\tgit fast-import\n-\t)\n-'\n-\n-test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print old blob' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 11\n-\t\tyes it can\n-\n-\t\tEOF\n-\t\techo \"cat-blob $blob\" |\n-\t\tgit fast-import --cat-blob-fd=6 6>actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo hello >greeting &&\n-\t\tblob=$(git hash-object -w greeting) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 6\n-\t\thello\n-\n-\t\tEOF\n-\t\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n-\t\tcat-blob $blob\n-\t\tEOF\n-\t\ttest_cmp expect actual.3 &&\n-\t\ttest_must_be_empty actual.1 &&\n-\t\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n-\t\toption cat-blob-fd=3\n-\t\tcat-blob $blob\n-\t\tEOF\n-\t\ttest_must_be_empty actual.3 &&\n-\t\ttest_cmp expect actual.1\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print mark for new blob' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"effluentish\" | git hash-object --stdin >expect &&\n-\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB_END\n-\t\teffluentish\n-\t\tBLOB_END\n-\t\tget-mark :1\n-\t\tEOF\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print new blob' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 12\n-\t\tyep yep yep\n-\n-\t\tEOF\n-\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB_END\n-\t\tyep yep yep\n-\t\tBLOB_END\n-\t\tcat-blob :1\n-\t\tEOF\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print new blob by sha1' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 25\n-\t\ta new blob named by sha1\n-\n-\t\tEOF\n-\t\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n-\t\tblob\n-\t\tdata <<BLOB_END\n-\t\ta new blob named by sha1\n-\t\tBLOB_END\n-\t\tcat-blob $blob\n-\t\tEOF\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-setup_big_file () {\n-\t(\n-\t\techo \"the quick brown fox jumps over the lazy dog\" >big &&\n-\t\tfor i in 1 2 3\n-\t\tdo\n-\t\t\tcat big big big big >bigger &&\n-\t\t\tcat bigger bigger bigger bigger >big ||\n-\t\t\texit\n-\t\tdone\n-\t)\n-}\n-\n-test_expect_success 'R: print two blobs to stdout' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsetup_big_file &&\n-\t\tblob1=$(git hash-object big) &&\n-\t\tblob1_len=$(wc -c <big) &&\n-\t\tblob2=$(echo hello | git hash-object --stdin) &&\n-\t\t{\n-\t\t\techo ${blob1} blob $blob1_len &&\n-\t\t\tcat big &&\n-\t\t\tcat <<-EOF\n-\n-\t\t\t${blob2} blob 6\n-\t\t\thello\n-\n-\t\t\tEOF\n-\t\t} >expect &&\n-\t\t{\n-\t\t\tcat <<-\\END_PART1 &&\n-\t\t\t\tblob\n-\t\t\t\tmark :1\n-\t\t\t\tdata <<data_end\n-\t\t\tEND_PART1\n-\t\t\tcat big &&\n-\t\t\tcat <<-\\EOF\n-\t\t\t\tdata_end\n-\t\t\t\tblob\n-\t\t\t\tmark :2\n-\t\t\t\tdata <<data_end\n-\t\t\t\thello\n-\t\t\t\tdata_end\n-\t\t\t\tcat-blob :1\n-\t\t\t\tcat-blob :2\n-\t\t\tEOF\n-\t\t} |\n-\t\tgit fast-import >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success PIPE 'R: copy using cat-file' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsetup_big_file &&\n-\t\texpect_id=$(git hash-object big) &&\n-\t\texpect_len=$(wc -c <big) &&\n-\t\techo $expect_id blob $expect_len >expect.response &&\n-\n-\t\trm -f blobs &&\n-\n-\t\tmkfifo blobs &&\n-\t\t(\n-\t\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n-\t\t\tcat <<-\\EOF &&\n-\t\t\tfeature cat-blob\n-\t\t\tblob\n-\t\t\tmark :1\n-\t\t\tdata <<BLOB\n-\t\t\tEOF\n-\t\t\tcat big &&\n-\t\t\tcat <<-\\EOF &&\n-\t\t\tBLOB\n-\t\t\tcat-blob :1\n-\t\t\tEOF\n-\n-\t\t\tread blob_id type size <&3 &&\n-\t\t\techo \"$blob_id $type $size\" >response &&\n-\t\t\ttest_copy_bytes $size >blob <&3 &&\n-\t\t\tread newline <&3 &&\n-\n-\t\t\tcat <<-EOF &&\n-\t\t\tcommit refs/heads/copied\n-\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\t\tdata <<COMMIT\n-\t\t\tcopy big file as file3\n-\t\t\tCOMMIT\n-\t\t\tM 644 inline file3\n-\t\t\tdata <<BLOB\n-\t\t\tEOF\n-\t\t\tcat blob &&\n-\t\t\techo BLOB\n-\t\t) 3<blobs |\n-\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\t\tgit show copied:file3 >actual &&\n-\t\ttest_cmp expect.response response &&\n-\t\ttest_cmp big actual\n-\t)\n-'\n-\n-test_expect_success PIPE 'R: print blob mid-commit' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f blobs &&\n-\t\techo \"A blob from _before_ the commit.\" >expect &&\n-\t\tmkfifo blobs &&\n-\t\t(\n-\t\t\texec 3<blobs &&\n-\t\t\tcat <<-EOF &&\n-\t\t\tfeature cat-blob\n-\t\t\tblob\n-\t\t\tmark :1\n-\t\t\tdata <<BLOB\n-\t\t\tA blob from _before_ the commit.\n-\t\t\tBLOB\n-\t\t\tcommit refs/heads/temporary\n-\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\t\tdata <<COMMIT\n-\t\t\tEmpty commit\n-\t\t\tCOMMIT\n-\t\t\tcat-blob :1\n-\t\t\tEOF\n-\n-\t\t\tread blob_id type size <&3 &&\n-\t\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\t\tread newline <&3 &&\n-\n-\t\t\techo\n-\t\t) |\n-\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success PIPE 'R: print staged blob within commit' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f blobs &&\n-\t\techo \"A blob from _within_ the commit.\" >expect &&\n-\t\tmkfifo blobs &&\n-\t\t(\n-\t\t\texec 3<blobs &&\n-\t\t\tcat <<-EOF &&\n-\t\t\tfeature cat-blob\n-\t\t\tcommit refs/heads/within\n-\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\t\tdata <<COMMIT\n-\t\t\tEmpty commit\n-\t\t\tCOMMIT\n-\t\t\tM 644 inline within\n-\t\t\tdata <<BLOB\n-\t\t\tA blob from _within_ the commit.\n-\t\t\tBLOB\n-\t\t\tEOF\n-\n-\t\t\tto_get=$(\n-\t\t\t\techo \"A blob from _within_ the commit.\" |\n-\t\t\t\tgit hash-object --stdin\n-\t\t\t) &&\n-\t\t\techo \"cat-blob $to_get\" &&\n-\n-\t\t\tread blob_id type size <&3 &&\n-\t\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\t\tread newline <&3 &&\n-\n-\t\t\techo deleteall\n-\t\t) |\n-\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'R: quiet option results in no stats being output' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\toption git quiet\n-\t\tblob\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\n-\t\tgit fast-import 2>output <input &&\n-\t\ttest_must_be_empty output\n-\t)\n-'\n-\n-test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo feature done | test_must_fail git fast-import &&\n-\t\ttest_must_fail git fast-import --done </dev/null\n-\t)\n-'\n-\n-test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit fast-import <<-\\EOF &&\n-\t\tfeature done\n-\t\tdone\n-\t\ttrailing gibberish\n-\t\tEOF\n-\t\tgit fast-import <<-\\EOF\n-\t\tdone\n-\t\tmore trailing gibberish\n-\t\tEOF\n-\t)\n-'\n-\n-test_expect_success 'R: terminating \"done\" within commit' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >expect <<-\\EOF &&\n-\t\tOBJID\n-\t\t:000000 100644 OBJID OBJID A\thello.c\n-\t\t:000000 100644 OBJID OBJID A\thello2.c\n-\t\tEOF\n-\t\tgit fast-import <<-EOF &&\n-\t\tcommit refs/heads/done-ends\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<EOT\n-\t\tCommit terminated by \"done\" command\n-\t\tEOT\n-\t\tM 100644 inline hello.c\n-\t\tdata <<EOT\n-\t\tHello, world.\n-\t\tEOT\n-\t\tC hello.c hello2.c\n-\t\tdone\n-\t\tEOF\n-\t\tgit rev-list done-ends |\n-\t\tgit diff-tree -r --stdin --root --always |\n-\t\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'R: die on unknown option' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\toption git non-existing-option\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: unknown commandline options are rejected' '\\\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --non-existing-option < /dev/null\n-\t)\n-'\n-\n-test_expect_success 'R: feature-only names are rejected on the command line' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tfor opt in --alias --get-mark --ls --notes\n-\t\tdo\n-\t\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n-\t\tdone\n-\t)\n-'\n-\n-test_expect_success 'R: die on invalid option argument' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"option git active-branches=-5\" |\n-\t\ttest_must_fail git fast-import &&\n-\t\techo \"option git depth=\" |\n-\t\ttest_must_fail git fast-import &&\n-\t\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n-\t)\n-'\n-\n-test_expect_success 'R: ignore non-git options' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\toption non-existing-vcs non-existing-option\n-\t\tEOF\n-\n-\t\tgit fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: corrupt lines do not mess marks file' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\tblob=$(echo hi | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t:3 $ZERO_OID\n-\t\t:1 $blob\n-\t\t:2 $blob\n-\t\tEOF\n-\t\tcp expect io.marks &&\n-\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks\n-\t)\n-'\n-\n-##\n-## R: very large blobs\n-##\n-test_expect_success 'R: blob bigger than threshold' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblobsize=$((2*1024*1024 + 53)) &&\n-\t\ttest-tool genrandom bar $blobsize >expect &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/big-file\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tR - big file\n-\t\tCOMMIT\n-\n-\t\tM 644 inline big1\n-\t\tdata $blobsize\n-\t\tINPUT_END\n-\t\tcat expect >>input &&\n-\t\tcat >>input <<-INPUT_END &&\n-\t\tM 644 inline big2\n-\t\tdata $blobsize\n-\t\tINPUT_END\n-\t\tcat expect >>input &&\n-\t\techo >>input &&\n-\n-\t\tgit -c fastimport.unpackLimit=0 fast-import --big-file-threshold=1 <input &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack -v \"$p\" || return 1\n-\t\tdone >verify &&\n-\n-\t\tgit cat-file blob big-file:big1 >actual &&\n-\t\ttest_cmp_bin expect actual &&\n-\t\ta=$(git rev-parse big-file:big1) &&\n-\t\tb=$(git rev-parse big-file:big2) &&\n-\t\ttest $a = $b &&\n-\t\tn=$(grep $a verify | wc -l) &&\n-\t\ttest 1 = $n\n-\t)\n-'\n-\n-###\n-### series S (mark and path parsing)\n-###\n-#\n-# Make sure missing spaces and EOLs after mark references\n-# cause errors.\n-#\n-# Setup:\n-#\n-#   1--2--4\n-#    \\   /\n-#     -3-\n-#\n-#   commit marks:  301, 302, 303, 304\n-#   blob marks:              403, 404, resp.\n-#   note mark:          202\n-#\n-# The error message when a space is missing not at the\n-# end of the line is:\n-#\n-#   missing space after ..\n-#\n-# or when extra characters come after the mark at the end\n-# of the line:\n-#\n-#   garbage after ..\n-#\n-# or when the dataref is neither \"inline \" or a known SHA1,\n-#\n-#   invalid dataref ..\n-#\n-setup_marks_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_tick &&\n-\n-\tcat >repo/input <<-INPUT_END &&\n-\tcommit refs/heads/S\n-\tmark :301\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 1\n-\tCOMMIT\n-\tM 100644 inline hello.c\n-\tdata <<BLOB\n-\tblob 1\n-\tBLOB\n-\n-\tcommit refs/heads/S\n-\tmark :302\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 2\n-\tCOMMIT\n-\tfrom :301\n-\tM 100644 inline hello.c\n-\tdata <<BLOB\n-\tblob 2\n-\tBLOB\n-\n-\tblob\n-\tmark :403\n-\tdata <<BLOB\n-\tblob 3\n-\tBLOB\n-\n-\tblob\n-\tmark :202\n-\tdata <<BLOB\n-\tnote 2\n-\tBLOB\n-\tINPUT_END\n-\n-\tgit -C repo fast-import --export-marks=marks <repo/input\n-}\n-\n-#\n-# filemodify, three datarefs\n-#\n-test_expect_success 'S: filemodify with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit N\n-\t\tCOMMIT\n-\t\tM 100644 :403x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after mark\" err\n-\t)\n-'\n-\n-# inline is misspelled; fast-import thinks it is some unknown dataref\n-test_expect_success 'S: filemodify with garbage after inline must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit N\n-\t\tCOMMIT\n-\t\tM 100644 inlineX hello.c\n-\t\tdata <<BLOB\n-\t\tinline\n-\t\tBLOB\n-\t\tEOF\n-\t\ttest_grep \"nvalid dataref\" err\n-\t)\n-'\n-\n-test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit N\n-\t\tCOMMIT\n-\t\tM 100644 ${sha1}x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after SHA1\" err\n-\t)\n-'\n-\n-#\n-# notemodify, three ways to say dataref\n-#\n-test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note dataref markref\n-\t\tCOMMIT\n-\t\tN :202x :302\n-\t\tEOF\n-\t\ttest_grep \"space after mark\" err\n-\t)\n-'\n-\n-test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note dataref inline\n-\t\tCOMMIT\n-\t\tN inlineX :302\n-\t\tdata <<BLOB\n-\t\tnote blob\n-\t\tBLOB\n-\t\tEOF\n-\t\ttest_grep \"nvalid dataref\" err\n-\t)\n-'\n-\n-test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note dataref sha1\n-\t\tCOMMIT\n-\t\tN ${sha1}x :302\n-\t\tEOF\n-\t\ttest_grep \"space after SHA1\" err\n-\t)\n-'\n-\n-#\n-# notemodify, mark in commit-ish\n-#\n-test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/Snotes\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note commit-ish\n-\t\tCOMMIT\n-\t\tN :202 :302x\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# from\n-#\n-test_expect_success 'S: from with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail \\\n-\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S2\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit 3\n-\t\tCOMMIT\n-\t\tfrom :301x\n-\t\tM 100644 :403 hello.c\n-\t\tEOF\n-\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-\n-#\n-# merge\n-#\n-test_expect_success 'S: merge with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n-\t\tcommit refs/heads/S2\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit 3\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tM 100644 :403 hello.c\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tmark :304\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tmerge 4\n-\t\tCOMMIT\n-\t\tfrom :302\n-\t\tmerge :303x\n-\t\tM 100644 :403 hello.c\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# tag, from markref\n-#\n-test_expect_success 'S: tag with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\ttag refs/tags/Stag\n-\t\tfrom :302x\n-\t\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<TAG\n-\t\ttag S\n-\t\tTAG\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# cat-blob markref\n-#\n-test_expect_success 'S: cat-blob with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcat-blob :403x\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# ls markref\n-#\n-test_expect_success 'S: ls with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tls :302x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after mark\" err\n-\t)\n-'\n-\n-test_expect_success 'S: ls with garbage after sha1 must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tls ${sha1}x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after tree-ish\" err\n-\t)\n-'\n-\n-#\n-# Path parsing\n-#\n-# There are two sorts of ways a path can be parsed, depending on whether it is\n-# the last field on the line. Additionally, ls without a <dataref> has a special\n-# case. Test every occurrence of <path> in the grammar against every error case.\n-# Paths for the root (empty strings) are tested elsewhere.\n-#\n-\n-#\n-# Valid paths at the end of a line: filemodify, filedelete, filecopy (dest),\n-# filerename (dest), and ls.\n-#\n-# commit :301 from root -- modify hello.c (for setup)\n-# commit :302 from :301 -- modify $path\n-# commit :303 from :302 -- delete $path\n-# commit :304 from :301 -- copy hello.c $path\n-# commit :305 from :301 -- rename hello.c $path\n-# ls :305 $path\n-#\n-test_path_eol_success () {\n-\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths at EOL with $test must work\" '\n-\t\ttest_when_finished \"git branch -D S-path-eol\" &&\n-\n-\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF >out 2>err &&\n-\t\tblob\n-\t\tmark :401\n-\t\tdata <<BLOB\n-\t\thello world\n-\t\tBLOB\n-\n-\t\tblob\n-\t\tmark :402\n-\t\tdata <<BLOB\n-\t\thallo welt\n-\t\tBLOB\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :301\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tinitial commit\n-\t\tCOMMIT\n-\t\tM 100644 :401 hello.c\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :302\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filemodify\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tM 100644 :402 $path\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filedelete\n-\t\tCOMMIT\n-\t\tfrom :302\n-\t\tD $path\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :304\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filecopy dest\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tC hello.c $path\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :305\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filerename dest\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tR hello.c $path\n-\n-\t\tls :305 $path\n-\t\tEOF\n-\n-\t\tcommit_m=$(grep :302 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_d=$(grep :303 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_c=$(grep :304 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_r=$(grep :305 marks.out | cut -d\\  -f2) &&\n-\t\tblob1=$(grep :401 marks.out | cut -d\\  -f2) &&\n-\t\tblob2=$(grep :402 marks.out | cut -d\\  -f2) &&\n-\n-\t\t(\n-\t\t\tprintf \"100644 blob $blob2\\t$unquoted_path\\n\" &&\n-\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n-\t\t) | sort >tree_m.exp &&\n-\t\tgit ls-tree $commit_m | sort >tree_m.out &&\n-\t\ttest_cmp tree_m.exp tree_m.out &&\n-\n-\t\tprintf \"100644 blob $blob1\\thello.c\\n\" >tree_d.exp &&\n-\t\tgit ls-tree $commit_d >tree_d.out &&\n-\t\ttest_cmp tree_d.exp tree_d.out &&\n-\n-\t\t(\n-\t\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" &&\n-\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n-\t\t) | sort >tree_c.exp &&\n-\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n-\t\ttest_cmp tree_c.exp tree_c.out &&\n-\n-\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" >tree_r.exp &&\n-\t\tgit ls-tree $commit_r >tree_r.out &&\n-\t\ttest_cmp tree_r.exp tree_r.out &&\n-\n-\t\ttest_cmp out tree_r.exp\n-\t'\n-}\n-\n-test_path_eol_success 'quoted spaces'   '\" hello world.c \"'  ' hello world.c '\n-test_path_eol_success 'unquoted spaces' ' hello world.c '    ' hello world.c '\n-test_path_eol_success 'octal escapes'   '\"\\150\\151\\056\\143\"' 'hi.c'\n-\n-#\n-# Valid paths before a space: filecopy (source) and filerename (source).\n-#\n-# commit :301 from root -- modify $path (for setup)\n-# commit :302 from :301 -- copy $path hello2.c\n-# commit :303 from :301 -- rename $path hello2.c\n-#\n-test_path_space_success () {\n-\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths before space with $test must work\" '\n-\t\ttest_when_finished \"git branch -D S-path-space\" &&\n-\n-\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF 2>err &&\n-\t\tblob\n-\t\tmark :401\n-\t\tdata <<BLOB\n-\t\thello world\n-\t\tBLOB\n-\n-\t\tcommit refs/heads/S-path-space\n-\t\tmark :301\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tinitial commit\n-\t\tCOMMIT\n-\t\tM 100644 :401 $path\n-\n-\t\tcommit refs/heads/S-path-space\n-\t\tmark :302\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filecopy source\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tC $path hello2.c\n-\n-\t\tcommit refs/heads/S-path-space\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filerename source\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tR $path hello2.c\n-\n-\t\tEOF\n-\n-\t\tcommit_c=$(grep :302 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_r=$(grep :303 marks.out | cut -d\\  -f2) &&\n-\t\tblob=$(grep :401 marks.out | cut -d\\  -f2) &&\n-\n-\t\t(\n-\t\t\tprintf \"100644 blob $blob\\t$unquoted_path\\n\" &&\n-\t\t\tprintf \"100644 blob $blob\\thello2.c\\n\"\n-\t\t) | sort >tree_c.exp &&\n-\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n-\t\ttest_cmp tree_c.exp tree_c.out &&\n-\n-\t\tprintf \"100644 blob $blob\\thello2.c\\n\" >tree_r.exp &&\n-\t\tgit ls-tree $commit_r >tree_r.out &&\n-\t\ttest_cmp tree_r.exp tree_r.out\n-\t'\n-}\n-\n-test_path_space_success 'quoted spaces'      '\" hello world.c \"'  ' hello world.c '\n-test_path_space_success 'no unquoted spaces' 'hello_world.c'      'hello_world.c'\n-test_path_space_success 'octal escapes'      '\"\\150\\151\\056\\143\"' 'hi.c'\n-\n-#\n-# Test a single commit change with an invalid path. Run it with all occurrences\n-# of <path> in the grammar against all error kinds.\n-#\n-test_path_fail () {\n-\tlocal change=\"$1\" what=\"$2\" prefix=\"$3\" path=\"$4\" suffix=\"$5\" err_grep=\"$6\"\n-\ttest_expect_success \"S: $change with $what must fail\" '\n-\t\ttest_must_fail git fast-import <<-EOF 2>err &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB\n-\t\thello world\n-\t\tBLOB\n-\n-\t\tcommit refs/heads/S-path-fail\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit setup\n-\t\tCOMMIT\n-\t\tM 100644 :1 hello.c\n-\n-\t\tcommit refs/heads/S-path-fail\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit with bad path\n-\t\tCOMMIT\n-\t\tfrom :2\n-\t\t$prefix$path$suffix\n-\t\tEOF\n-\n-\t\ttest_grep \"$err_grep\" err\n-\t'\n-}\n-\n-test_path_base_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\" suffix=\"$4\"\n-\ttest_path_fail \"$change\" 'unclosed \" in '\"$field\"          \"$prefix\" '\"hello.c'    \"$suffix\" \"invalid $field\"\n-\ttest_path_fail \"$change\" \"invalid escape in quoted $field\" \"$prefix\" '\"hello\\xff\"' \"$suffix\" \"invalid $field\"\n-\ttest_path_fail \"$change\" \"escaped NUL in quoted $field\"    \"$prefix\" '\"hello\\000\"' \"$suffix\" \"NUL in $field\"\n-}\n-test_path_eol_quoted_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n-\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ''\n-\ttest_path_fail \"$change\" \"garbage after quoted $field\" \"$prefix\" '\"hello.c\"' 'x' \"garbage after $field\"\n-\ttest_path_fail \"$change\" \"space after quoted $field\"   \"$prefix\" '\"hello.c\"' ' ' \"garbage after $field\"\n-}\n-test_path_eol_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n-\ttest_path_eol_quoted_fail \"$change\" \"$prefix\" \"$field\"\n-}\n-test_path_space_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n-\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ' world.c'\n-\ttest_path_fail \"$change\" \"missing space after quoted $field\"   \"$prefix\" '\"hello.c\"' 'x world.c' \"missing space after $field\"\n-\ttest_path_fail \"$change\" \"missing space after unquoted $field\" \"$prefix\" 'hello.c'   ''          \"missing space after $field\"\n-}\n-\n-test_path_eol_fail   filemodify       'M 100644 :1 ' path\n-test_path_eol_fail   filedelete       'D '           path\n-test_path_space_fail filecopy         'C '           source\n-test_path_eol_fail   filecopy         'C hello.c '   dest\n-test_path_space_fail filerename       'R '           source\n-test_path_eol_fail   filerename       'R hello.c '   dest\n-test_path_eol_fail   'ls (in commit)' 'ls :2 '       path\n-\n-# When 'ls' has no <dataref>, the <path> must be quoted.\n-test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n-\n-###\n-### series T (ls)\n-###\n-\n-for root in '\"\"' ''\n-do\n-\ttest_expect_success \"T: ls root ($root) tree\" '\n-\t\ttest_when_finished \"rm -rf repo\" &&\n-\t\tgit init repo &&\n-\t\t(\n-\t\t\tcd repo &&\n-\t\t\ttest_commit one &&\n-\n-\t\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n-\t\t\t040000 tree $(git rev-parse HEAD^{tree})\tZ\n-\t\t\tEOF\n-\t\t\tsha1=$(git rev-parse --verify HEAD) &&\n-\t\t\tgit fast-import <<-EOF >actual &&\n-\t\t\tls $sha1 $root\n-\t\t\tEOF\n-\t\t\ttest_cmp expect actual\n-\t\t)\n-\t'\n-done\n-\n-test_expect_success 'T: delete branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tgit branch to-delete &&\n-\t\tgit fast-import <<-EOF &&\n-\t\treset refs/heads/to-delete\n-\t\tfrom $ZERO_OID\n-\t\tEOF\n-\t\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n-\t)\n-'\n-\n-test_expect_success 'T: empty reset doesnt delete branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tgit branch not-to-delete &&\n-\t\tgit fast-import <<-EOF &&\n-\t\treset refs/heads/not-to-delete\n-\t\tEOF\n-\t\tgit show-ref &&\n-\t\tgit rev-parse --verify refs/heads/not-to-delete\n-\t)\n-'\n-\n ###\n ### series U (filedelete)\n ###\n@@ -4316,456 +1203,4 @@ do\n \t'\n done\n \n-###\n-### series V (checkpoint)\n-###\n-\n-# The commands in input_file should not produce any output on the file\n-# descriptor set with --cat-blob-fd (or stdout if unspecified).\n-#\n-# To make sure you're observing the side effects of checkpoint *before*\n-# fast-import terminates (and thus writes out its state), check that the\n-# fast-import process is still running using background_import_still_running\n-# *after* evaluating the test conditions.\n-background_import_then_checkpoint () {\n-\toptions=$1\n-\tinput_file=$2\n-\n-\tmkfifo V.input\n-\texec 8<>V.input\n-\trm V.input\n-\n-\tmkfifo V.output\n-\texec 9<>V.output\n-\trm V.output\n-\n-\t(\n-\t\tgit -C repo fast-import $options <&8 >&9 &\n-\t\techo $! >&9\n-\t\twait $!\n-\t\techo >&2 \"background fast-import terminated too early with exit code $?\"\n-\t\t# Un-block the read loop in the main shell process.\n-\t\techo >&9 UNEXPECTED\n-\t) &\n-\tsh_pid=$!\n-\tread fi_pid <&9\n-\t# We don't mind if fast-import has already died by the time the test\n-\t# ends.\n-\ttest_when_finished \"\n-\t\texec 8>&-; exec 9>&-;\n-\t\tkill $sh_pid && wait $sh_pid\n-\t\tkill $fi_pid && wait $fi_pid\n-\t\ttrue\"\n-\n-\t# Start in the background to ensure we adhere strictly to (blocking)\n-\t# pipes writing sequence. We want to assume that the write below could\n-\t# block, e.g. if fast-import blocks writing its own output to &9\n-\t# because there is no reader on &9 yet.\n-\t(\n-\t\tcat \"$input_file\"\n-\t\techo \"checkpoint\"\n-\t\techo \"progress checkpoint\"\n-\t) >&8 &\n-\n-\tlast=$(\n-\t\twhile read output <&9\n-\t\tdo\n-\t\t\tif test \"$output\" = \"progress checkpoint\" || test \"$output\" = \"UNEXPECTED\"\n-\t\t\tthen\n-\t\t\t\techo \"$output\"\n-\t\t\t\tbreak\n-\t\t\telse\n-\t\t\t\t# otherwise ignore cruft\n-\t\t\t\techo >&2 \"cruft: $output\"\n-\t\t\tfi\n-\t\tdone\n-\t)\n-\n-\ttest \"$last\" = \"progress checkpoint\"\n-}\n-\n-background_import_still_running () {\n-\tif ! kill -0 \"$fi_pid\"\n-\tthen\n-\t\techo >&2 \"background fast-import terminated too early\"\n-\t\tfalse\n-\tfi\n-}\n-\n-setup_checkpoint_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_tick &&\n-\tgit -C repo fast-import <<-INPUT_END\n-\tcommit refs/heads/base\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tbase commit\n-\tCOMMIT\n-\tINPUT_END\n-}\n-\n-test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-INPUT_END &&\n-\tprogress foo\n-\tprogress bar\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"\" repo/input &&\n-\tbackground_import_still_running\n-'\n-\n-test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-\\INPUT_END &&\n-\treset refs/heads/V\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"\" repo/input &&\n-\ttest \"$(git -C repo rev-parse --verify V)\" = \"$(git -C repo rev-parse --verify base)\" &&\n-\tbackground_import_still_running\n-'\n-\n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-INPUT_END &&\n-\tcommit refs/heads/V\n-\tmark :1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n-\n-\t\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify base)\" &&\n-\t\ttest_cmp marks.expected marks.actual\n-\t) &&\n-\tbackground_import_still_running\n-'\n-\n-# Re-create the exact same commit, but on a different branch: no new object is\n-# created in the database, but the refs and marks still need to be updated.\n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n-\tsetup_checkpoint_repo &&\n-\tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n-\tcommit refs/heads/V\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tcat >repo/input <<-INPUT_END &&\n-\tcommit refs/heads/V2\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n-\n-\t\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n-\t\ttest_cmp marks.expected marks.actual\n-\t) &&\n-\tbackground_import_still_running\n-'\n-\n-test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-INPUT_END &&\n-\ttag Vtag\n-\tfrom refs/heads/base\n-\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"\" repo/input &&\n-\tgit -C repo show-ref -d Vtag &&\n-\tbackground_import_still_running\n-'\n-\n-###\n-### series W (get-mark and empty orphan commits)\n-###\n-\n-w_input () {\n-\tcat <<-W_INPUT_END\n-\tcommit refs/heads/W-branch\n-\tmark :1\n-\tauthor Full Name <user@company.tld> 1000000000 +0100\n-\tcommitter Full Name <user@company.tld> 1000000000 +0100\n-\tdata 27\n-\tIntentionally empty commit\n-\tLFsget-mark :1\n-\tW_INPUT_END\n-}\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tw_input | sed -e s/LFs// | tr L \"\\n\" | git fast-import\n-\t)\n-'\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tw_input | sed -e s/LFs/L/ | tr L \"\\n\" | git fast-import\n-\t)\n-'\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t# Technically, this should fail as it has too many linefeeds\n-\t\t# according to the grammar in fast-import.txt.  But, for whatever\n-\t\t# reason, it works.  Since using the correct number of newlines\n-\t\t# does not work with older (pre-2.22) versions of git, allow apps\n-\t\t# that used this second-newline workaround to keep working by\n-\t\t# checking it with this test...\n-\t\tw_input | sed -e s/LFs/LL/ | tr L \"\\n\" | git fast-import\n-\t)\n-'\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t# ...but do NOT allow more empty lines than that (see previous test).\n-\t\tw_input | sed -e s/LFs/LLL/ | tr L \"\\n\" | test_must_fail git fast-import\n-\t)\n-'\n-\n-###\n-### series X (other new features)\n-###\n-\n-test_expect_success ICONV 'X: handling encoding' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/encoding\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tencoding iso-8859-7\n-\t\tdata <<COMMIT\n-\t\tINPUT_END\n-\n-\t\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n-\n-\t\tgit fast-import <input &&\n-\t\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n-\t\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n-\t)\n-'\n-\n-test_expect_success 'X: replace ref that becomes useless is removed' '\n-\ttest_when_finished \"rm -rf testrepo\" &&\n-\tgit init -qb main testrepo &&\n-\t(\n-\t\tcd testrepo &&\n-\t\ttest_commit test &&\n-\n-\t\ttest_commit msg somename content &&\n-\n-\t\tgit mv somename othername &&\n-\t\tNEW_TREE=$(git write-tree) &&\n-\t\tMSG=\"$(git log -1 --format=%B HEAD)\" &&\n-\t\tNEW_COMMIT=$(git commit-tree -p HEAD^1 -m \"$MSG\" $NEW_TREE) &&\n-\t\tgit replace main $NEW_COMMIT &&\n-\n-\t\techo more >>othername &&\n-\t\tgit add othername &&\n-\t\tgit commit -qm more &&\n-\n-\t\tgit fast-export --all >tmp &&\n-\t\tsed -e s/othername/somename/ tmp >tmp2 &&\n-\t\tgit fast-import --force <tmp2 2>msgs &&\n-\n-\t\ttest_grep \"dropping.*since it would point to itself\" msgs &&\n-\t\tgit show-ref >refs &&\n-\t\ttest_grep ! refs/replace refs\n-\t)\n-'\n-\n-###\n-### series Y (submodules and hash algorithms)\n-###\n-\n-cat >Y-sub-input <<\\Y_INPUT_END\n-blob\n-mark :1\n-data 4\n-foo\n-\n-reset refs/heads/main\n-commit refs/heads/main\n-mark :2\n-author Full Name <user@company.tld> 1000000000 +0100\n-committer Full Name <user@company.tld> 1000000000 +0100\n-data 24\n-Test submodule commit 1\n-M 100644 :1 file\n-\n-blob\n-mark :3\n-data 8\n-foo\n-bar\n-\n-commit refs/heads/main\n-mark :4\n-author Full Name <user@company.tld> 1000000001 +0100\n-committer Full Name <user@company.tld> 1000000001 +0100\n-data 24\n-Test submodule commit 2\n-from :2\n-M 100644 :3 file\n-Y_INPUT_END\n-\n-# Note that the submodule object IDs are intentionally not translated.\n-cat >Y-main-input <<\\Y_INPUT_END\n-blob\n-mark :1\n-data 4\n-foo\n-\n-reset refs/heads/main\n-commit refs/heads/main\n-mark :2\n-author Full Name <user@company.tld> 2000000000 +0100\n-committer Full Name <user@company.tld> 2000000000 +0100\n-data 14\n-Test commit 1\n-M 100644 :1 file\n-\n-blob\n-mark :3\n-data 73\n-[submodule \"sub1\"]\n-\tpath = sub1\n-\turl = https://void.example.com/main.git\n-\n-commit refs/heads/main\n-mark :4\n-author Full Name <user@company.tld> 2000000001 +0100\n-committer Full Name <user@company.tld> 2000000001 +0100\n-data 14\n-Test commit 2\n-from :2\n-M 100644 :3 .gitmodules\n-M 160000 0712c5be7cf681388e355ef47525aaf23aee1a6d sub1\n-\n-blob\n-mark :5\n-data 8\n-foo\n-bar\n-\n-commit refs/heads/main\n-mark :6\n-author Full Name <user@company.tld> 2000000002 +0100\n-committer Full Name <user@company.tld> 2000000002 +0100\n-data 14\n-Test commit 3\n-from :4\n-M 100644 :5 file\n-M 160000 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7 sub1\n-Y_INPUT_END\n-\n-cat >Y-marks <<\\Y_INPUT_END\n-:2 0712c5be7cf681388e355ef47525aaf23aee1a6d\n-:4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n-Y_INPUT_END\n-\n-test_expect_success 'Y: rewrite submodules' '\n-\ttest_when_finished \"rm -rf main1\" &&\n-\ttest_oid_cache <<-EOF &&\n-\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n-\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n-\tEOF\n-\tgit init main1 &&\n-\t(\n-\t\tcd main1 &&\n-\t\tgit init sub2 &&\n-\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n-\t\tgit fast-import --rewrite-submodules-from=sub:../Y-marks \\\n-\t\t\t--rewrite-submodules-to=sub:sub2-marks <../Y-main-input &&\n-\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n-\t)\n-'\n-\n-test_expect_success 'Y: reference pending tag or commit' '\n-\ttest_oid_cache <<-EOF &&\n-\tpending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04\n-\tpending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d\n-\tpending_tag sha1:ec6c4db71feb5f66615214dad2324ce030e777a7\n-\tpending_tag sha256:85edc5eac315bc680677b2fc71622bd77476f057eb8dc8ed6a497803a24f1f46\n-\tEOF\n-\n-\ttest_when_finished \"rm -rf reference-pending\" &&\n-\tgit init reference-pending &&\n-\t(\n-\t\tcd reference-pending &&\n-\t\tgit fast-import <<-EOF\n-\t\tcommit refs/heads/main\n-\t\tcommitter A U Thor <author@example.com> 1712563200 +0000\n-\t\tdata 14\n-\t\tcommit message\n-\t\tM 644 inline test file\n-\t\tdata 14\n-\t\tdummy content\n-\n-\t\ttag newtag\n-\t\tfrom $(test_oid pending_commit)\n-\t\ttagger A U Thor <author@example.com> 1712563300 +0000\n-\t\tdata 11\n-\t\ttag message\n-\t\t# no emty line after tag data!\n-\t\treset refs/heads/other\n-\t\tfrom $(test_oid pending_tag)\n-\n-\t\tcommit refs/heads/further\n-\t\tcommitter A U Thor <author@example.com> 1712563400 +0000\n-\t\tdata 21\n-\t\twhat about 2nd commit\n-\t\tfrom $(test_oid pending_commit)\n-\t\tM 644 inline other test file\n-\t\tdata 19\n-\t\tmore dummy content\n-\n-\t\tdone\n-\t\tEOF\n-\t)\n-'\n-\n test_done\ndiff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh\nindex e62173cf1f..5d43a523d0 100755\n--- a/t/t9301-fast-import-notes.sh\n+++ b/t/t9301-fast-import-notes.sh\n@@ -724,4 +724,415 @@ test_expect_success \"add notes to $num_commits commits in each of $num_notes_ref\n \n '\n \n+setup_notes_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tfile2_data=\"file2\n+second line of EOF\" &&\n+\tfile4_data=abcd &&\n+\tfile4_len=4 &&\n+\tfile5_data=\"an inline file.\n+  we should see it later.\" &&\n+\tfile6_data=\"#!/bin/sh\n+echo \\\"\\$@\\\"\" &&\n+\tnote1_data=\"The first note for the first commit\" &&\n+\tnote2_data=\"The first note for the second commit\" &&\n+\tnote3_data=\"The first note for the third commit\" &&\n+\tnote1b_data=\"The second note for the first commit\" &&\n+\tnote1c_data=\"The third note for the first commit\" &&\n+\tnote2b_data=\"The second note for the second commit\" &&\n+\n+\ttest_tick &&\n+\tcat >repo/input <<-INPUT_END &&\n+\tblob\n+\tmark :2\n+\tdata <<EOF\n+\t$file2_data\n+\tEOF\n+\n+\tcommit refs/heads/notes-test\n+\tmark :3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tfirst (:3)\n+\tCOMMIT\n+\n+\tM 644 :2 file2\n+\n+\tblob\n+\tmark :4\n+\tdata $file4_len\n+\t$file4_data\n+\tcommit refs/heads/notes-test\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tsecond (:5)\n+\tCOMMIT\n+\n+\tM 644 :4 file4\n+\n+\tcommit refs/heads/notes-test\n+\tmark :6\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tthird (:6)\n+\tCOMMIT\n+\n+\tM 644 inline file5\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\n+\tM 755 inline file6\n+\tdata <<EOF\n+\t$file6_data\n+\tEOF\n+\n+\tblob\n+\tmark :7\n+\tdata <<EOF\n+\t$note1_data\n+\tEOF\n+\n+\tblob\n+\tmark :8\n+\tdata <<EOF\n+\t$note2_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :9\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:9)\n+\tCOMMIT\n+\n+\tN :7 :3\n+\tN :8 :5\n+\tN inline :6\n+\tdata <<EOF\n+\t$note3_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :10\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:10)\n+\tCOMMIT\n+\n+\tN inline :3\n+\tdata <<EOF\n+\t$note1b_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar2\n+\tmark :11\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:11)\n+\tCOMMIT\n+\n+\tN inline :3\n+\tdata <<EOF\n+\t$note1c_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :12\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:12)\n+\tCOMMIT\n+\n+\tdeleteall\n+\tN inline :5\n+\tdata <<EOF\n+\t$note2b_data\n+\tEOF\n+\n+\tINPUT_END\n+\n+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <repo/input &&\n+\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n+\tcommit2=$(git -C repo rev-parse notes-test^) &&\n+\tcommit3=$(git -C repo rev-parse notes-test)\n+}\n+\n+test_expect_success 'Q: verify pack' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tfirst (:3)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit1\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tsecond (:5)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit2\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tthird (:6)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:9)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for third commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar~2)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:10)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second note for first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for third commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:11)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third note for first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1c_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify fourth notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar^)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:12)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify fourth notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit2\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second note for second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: deny note on empty branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-EOF &&\n+\t\treset refs/heads/Q0\n+\n+\t\tcommit refs/heads/note-Q0\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tNote for an empty branch.\n+\t\tCOMMIT\n+\n+\t\tN inline refs/heads/Q0\n+\t\tdata <<NOTE\n+\t\tsome note\n+\t\tNOTE\n+\t\tEOF\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n test_done\ndiff --git a/t/t9304-fast-import-marks.sh b/t/t9304-fast-import-marks.sh\nindex 6c50adca00..437f9016fa 100755\n--- a/t/t9304-fast-import-marks.sh\n+++ b/t/t9304-fast-import-marks.sh\n@@ -79,4 +79,397 @@ test_expect_success 'relative marks are not affected by subdir' '\n \ttest_path_is_file deep-relative/.git/info/fast-import/exported-marks\n '\n \n+test_expect_success 'R: export-marks feature results in a marks file being created' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature export-marks=git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_grep :1 git.marks\n+\t)\n+'\n+\n+test_expect_success 'R: export-marks options can be overridden by commandline options' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-\\EOF &&\n+\t\tfeature export-marks=feature-sub/git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\tgit fast-import --allow-unsafe-features \\\n+\t\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n+\t\ttest_grep :1 cmdline-sub/other.marks &&\n+\t\ttest_path_is_missing feature-sub\n+\t)\n+'\n+\n+test_expect_success 'R: catch typo in marks file name' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n+\t\techo \"feature import-marks=nonexistent.marks\" |\n+\t\ttest_must_fail git fast-import --allow-unsafe-features\n+\t)\n+'\n+\n+test_expect_success 'R: import and output marks can be the same file' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n+'\n+\n+test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t)\n+'\n+\n+test_expect_success 'R: --import-marks-if-exists' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n+'\n+\n+test_expect_success 'R: feature import-marks-if-exists' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks &&\n+\n+\t\tblob=$(echo hi | git hash-object -w --stdin) &&\n+\n+\t\techo \":1 $blob\" >io.marks &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\techo \":2 $blob\" >>expect &&\n+\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n+\n+\t\techo \":3 $blob\" >>expect &&\n+\n+\t\tgit fast-import --import-marks=io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tblob\n+\t\tmark :3\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n+\n+\t\tgit fast-import --import-marks-if-exists=not_io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks\n+\t)\n+'\n+\n+test_expect_success 'R: corrupt lines do not mess marks file' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:3 $ZERO_OID\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tcp expect io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n+'\n+\n+create_marks_file () {\n+\tgit fast-import --export-marks=\"$1\" <<-EOF\n+\tblob\n+\tmark :1\n+\tdata 4\n+\tone\n+\n+\tblob\n+\tmark :2\n+\tdata 4\n+\ttwo\n+\n+\tblob\n+\tmark :3\n+\tdata 6\n+\tthree\n+\n+\tblob\n+\tmark :4\n+\tdata 5\n+\tfour\n+\n+\tcommit refs/heads/marks\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit with a mark\n+\tCOMMIT\n+\tM 100644 :1 one\n+\n+\ttag marks-tag\n+\tmark :6\n+\tfrom :5\n+\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<TAG\n+\ttag with a mark\n+\tTAG\n+\n+\tEOF\n+}\n+\n+test_expect_success 'R: import to output marks works without any content' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=marks.out\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n+'\n+\n+test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n+'\n+\n+test_expect_success 'R: multiple --import-marks= should be honoured' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=combined.marks\n+\t\tEOF\n+\n+\t\thead -n2 marks.out >one.marks &&\n+\t\ttail -n +3 marks.out >two.marks &&\n+\t\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n+\t\t\t--allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out combined.marks\n+\t)\n+'\n+\n+test_expect_success 'R: feature relative-marks should be honoured' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature export-marks=relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out .git/info/fast-import/relative.out\n+\t)\n+'\n+\n+test_expect_success 'R: feature no-relative-marks should be honoured' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature no-relative-marks\n+\t\tfeature export-marks=non-relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out non-relative.out\n+\t)\n+'\n+\n+test_expect_success 'A: export marks with large values' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_tick &&\n+\t\tmt=$(git hash-object --stdin < /dev/null) &&\n+\t\t>input.blob &&\n+\t\t>marks.exp &&\n+\t\t>tree.exp &&\n+\n+\t\tcat >input.commit <<-EOF &&\n+\t\tcommit refs/heads/verify--dump-marks\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttest the sparse array dumping routines with exponentially growing marks\n+\t\tCOMMIT\n+\t\tEOF\n+\n+\t\ti=0 l=4 m=6 n=7 &&\n+\t\twhile test \"$i\" -lt 27\n+\t\tdo\n+\t\t\tcat >>input.blob <<-EOF &&\n+\t\t\tblob\n+\t\t\tmark :$l\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$m\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$n\n+\t\t\tdata 0\n+\t\t\tEOF\n+\t\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n+\n+\t\t\techo \":$l $mt\" >>marks.exp &&\n+\t\t\techo \":$m $mt\" >>marks.exp &&\n+\t\t\techo \":$n $mt\" >>marks.exp &&\n+\n+\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n+\n+\t\t\tl=$(($l + $l)) &&\n+\t\t\tm=$(($m + $m)) &&\n+\t\t\tn=$(($l + $n)) &&\n+\n+\t\t\ti=$((1 + $i)) || return 1\n+\t\tdone &&\n+\n+\t\tsort tree.exp > tree.exp_s &&\n+\n+\t\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n+\t\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n+\t\ttest_cmp tree.exp_s tree.out &&\n+\t\ttest_cmp marks.exp marks.large\n+\t)\n+'\n+\n test_done\ndiff --git a/t/t9307-fast-import-validation.sh b/t/t9307-fast-import-validation.sh\nnew file mode 100755\nindex 0000000000..e52ae3326f\n--- /dev/null\n+++ b/t/t9307-fast-import-validation.sh\n@@ -0,0 +1,1193 @@\n+#!/bin/sh\n+\n+test_description='git fast-import validation'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'B: fail on invalid blob sha1' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit base &&\n+\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/branch\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\t\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit new &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit TEMP_TAG\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttag base\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n+\t\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n+\t)\n+'\n+\n+test_expect_success 'B: accept empty committer' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-1\n+\t\tcommitter  <> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n+'\n+\n+test_expect_success 'B: reject invalid timezone' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: accept invalid timezone with raw-permissive' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import --date-format=raw-permissive <input &&\n+\t\tgit cat-file -p invalid-timezone >out &&\n+\t\ttest_grep \"1234567890 [+]051800\" out\n+\t)\n+'\n+\n+test_expect_success 'B: accept and fixup committer with no name' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-2\n+\t\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (1)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (2)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (3)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email>> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (4)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (5)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name<email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of ..' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 ../invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of .' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tGood path\n+\t\tCOMMIT\n+\t\tM 100644 :1 ok-path\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tBad path\n+\t\tCOMMIT\n+\t\tR ok-path ./invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 C:/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of .git' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 .git/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of .gitmodules' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 120000 :1 .gitmodules\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: abort on unsupported feature' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature no-such-feature-exists\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: supported feature is accepted' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: abort on receiving feature after data command' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: import-marks features forbidden by default' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t>git.marks &&\n+\t\techo \"feature import-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input &&\n+\t\techo \"feature import-marks-if-exists=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: only one import-marks feature allowed per stream' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t>git.marks &&\n+\t\t>git2.marks &&\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=git.marks\n+\t\tfeature import-marks=git2.marks\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --allow-unsafe-features <input\n+\t)\n+'\n+\n+test_expect_success 'R: export-marks feature forbidden by default' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature export-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: feature ls supported' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature ls\" |\n+\t\tgit fast-import\n+\t)\n+'\n+\n+test_expect_success 'R: feature cat-blob supported' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature cat-blob\" |\n+\t\tgit fast-import\n+\t)\n+'\n+\n+test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: die on unknown option' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\toption git non-existing-option\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: unknown commandline options are rejected' '\\\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --non-existing-option < /dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: feature-only names are rejected on the command line' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfor opt in --alias --get-mark --ls --notes\n+\t\tdo\n+\t\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n+\t\tdone\n+\t)\n+'\n+\n+test_expect_success 'R: die on invalid option argument' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"option git active-branches=-5\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\techo \"option git depth=\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: ignore non-git options' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\toption non-existing-vcs non-existing-option\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n+'\n+\n+#\n+# Make sure missing spaces and EOLs after mark references\n+# cause errors.\n+#\n+# Setup:\n+#\n+#   1--2--4\n+#    \\   /\n+#     -3-\n+#\n+#   commit marks:  301, 302, 303, 304\n+#   blob marks:              403, 404, resp.\n+#   note mark:          202\n+#\n+# The error message when a space is missing not at the\n+# end of the line is:\n+#\n+#   missing space after ..\n+#\n+# or when extra characters come after the mark at the end\n+# of the line:\n+#\n+#   garbage after ..\n+#\n+# or when the dataref is neither \"inline \" or a known SHA1,\n+#\n+#   invalid dataref ..\n+#\n+setup_marks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_tick &&\n+\n+\tcat >repo/input <<-INPUT_END &&\n+\tcommit refs/heads/S\n+\tmark :301\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit 1\n+\tCOMMIT\n+\tM 100644 inline hello.c\n+\tdata <<BLOB\n+\tblob 1\n+\tBLOB\n+\n+\tcommit refs/heads/S\n+\tmark :302\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit 2\n+\tCOMMIT\n+\tfrom :301\n+\tM 100644 inline hello.c\n+\tdata <<BLOB\n+\tblob 2\n+\tBLOB\n+\n+\tblob\n+\tmark :403\n+\tdata <<BLOB\n+\tblob 3\n+\tBLOB\n+\n+\tblob\n+\tmark :202\n+\tdata <<BLOB\n+\tnote 2\n+\tBLOB\n+\tINPUT_END\n+\n+\tgit -C repo fast-import --export-marks=marks <repo/input\n+}\n+\n+#\n+# filemodify, three datarefs\n+#\n+test_expect_success 'S: filemodify with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 :403x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n+'\n+\n+# inline is misspelled; fast-import thinks it is some unknown dataref\n+test_expect_success 'S: filemodify with garbage after inline must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 inlineX hello.c\n+\t\tdata <<BLOB\n+\t\tinline\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n+'\n+\n+test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n+'\n+\n+#\n+# notemodify, three ways to say dataref\n+#\n+test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref markref\n+\t\tCOMMIT\n+\t\tN :202x :302\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n+'\n+\n+test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref inline\n+\t\tCOMMIT\n+\t\tN inlineX :302\n+\t\tdata <<BLOB\n+\t\tnote blob\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n+'\n+\n+test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref sha1\n+\t\tCOMMIT\n+\t\tN ${sha1}x :302\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n+'\n+\n+#\n+# notemodify, mark in commit-ish\n+#\n+test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/Snotes\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note commit-ish\n+\t\tCOMMIT\n+\t\tN :202 :302x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# from\n+#\n+test_expect_success 'S: from with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail \\\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+\n+#\n+# merge\n+#\n+test_expect_success 'S: merge with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tmark :304\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tmerge 4\n+\t\tCOMMIT\n+\t\tfrom :302\n+\t\tmerge :303x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# tag, from markref\n+#\n+test_expect_success 'S: tag with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\ttag refs/tags/Stag\n+\t\tfrom :302x\n+\t\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<TAG\n+\t\ttag S\n+\t\tTAG\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# cat-blob markref\n+#\n+test_expect_success 'S: cat-blob with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcat-blob :403x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# ls markref\n+#\n+test_expect_success 'S: ls with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls :302x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n+'\n+\n+test_expect_success 'S: ls with garbage after sha1 must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after tree-ish\" err\n+\t)\n+'\n+\n+#\n+# Path parsing\n+#\n+# There are two sorts of ways a path can be parsed, depending on whether it is\n+# the last field on the line. Additionally, ls without a <dataref> has a special\n+# case. Test every occurrence of <path> in the grammar against every error case.\n+# Paths for the root (empty strings) are tested elsewhere.\n+#\n+\n+#\n+# Valid paths at the end of a line: filemodify, filedelete, filecopy (dest),\n+# filerename (dest), and ls.\n+#\n+# commit :301 from root -- modify hello.c (for setup)\n+# commit :302 from :301 -- modify $path\n+# commit :303 from :302 -- delete $path\n+# commit :304 from :301 -- copy hello.c $path\n+# commit :305 from :301 -- rename hello.c $path\n+# ls :305 $path\n+#\n+test_path_eol_success () {\n+\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n+\ttest_expect_success \"S: paths at EOL with $test must work\" '\n+\t\ttest_when_finished \"git branch -D S-path-eol\" &&\n+\n+\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF >out 2>err &&\n+\t\tblob\n+\t\tmark :401\n+\t\tdata <<BLOB\n+\t\thello world\n+\t\tBLOB\n+\n+\t\tblob\n+\t\tmark :402\n+\t\tdata <<BLOB\n+\t\thallo welt\n+\t\tBLOB\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :301\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitial commit\n+\t\tCOMMIT\n+\t\tM 100644 :401 hello.c\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :302\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filemodify\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tM 100644 :402 $path\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filedelete\n+\t\tCOMMIT\n+\t\tfrom :302\n+\t\tD $path\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :304\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filecopy dest\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tC hello.c $path\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :305\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filerename dest\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tR hello.c $path\n+\n+\t\tls :305 $path\n+\t\tEOF\n+\n+\t\tcommit_m=$(grep :302 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_d=$(grep :303 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_c=$(grep :304 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_r=$(grep :305 marks.out | cut -d\\  -f2) &&\n+\t\tblob1=$(grep :401 marks.out | cut -d\\  -f2) &&\n+\t\tblob2=$(grep :402 marks.out | cut -d\\  -f2) &&\n+\n+\t\t(\n+\t\t\tprintf \"100644 blob $blob2\\t$unquoted_path\\n\" &&\n+\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n+\t\t) | sort >tree_m.exp &&\n+\t\tgit ls-tree $commit_m | sort >tree_m.out &&\n+\t\ttest_cmp tree_m.exp tree_m.out &&\n+\n+\t\tprintf \"100644 blob $blob1\\thello.c\\n\" >tree_d.exp &&\n+\t\tgit ls-tree $commit_d >tree_d.out &&\n+\t\ttest_cmp tree_d.exp tree_d.out &&\n+\n+\t\t(\n+\t\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" &&\n+\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n+\t\t) | sort >tree_c.exp &&\n+\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n+\t\ttest_cmp tree_c.exp tree_c.out &&\n+\n+\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" >tree_r.exp &&\n+\t\tgit ls-tree $commit_r >tree_r.out &&\n+\t\ttest_cmp tree_r.exp tree_r.out &&\n+\n+\t\ttest_cmp out tree_r.exp\n+\t'\n+}\n+\n+test_path_eol_success 'quoted spaces'   '\" hello world.c \"'  ' hello world.c '\n+test_path_eol_success 'unquoted spaces' ' hello world.c '    ' hello world.c '\n+test_path_eol_success 'octal escapes'   '\"\\150\\151\\056\\143\"' 'hi.c'\n+\n+#\n+# Valid paths before a space: filecopy (source) and filerename (source).\n+#\n+# commit :301 from root -- modify $path (for setup)\n+# commit :302 from :301 -- copy $path hello2.c\n+# commit :303 from :301 -- rename $path hello2.c\n+#\n+test_path_space_success () {\n+\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n+\ttest_expect_success \"S: paths before space with $test must work\" '\n+\t\ttest_when_finished \"git branch -D S-path-space\" &&\n+\n+\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF 2>err &&\n+\t\tblob\n+\t\tmark :401\n+\t\tdata <<BLOB\n+\t\thello world\n+\t\tBLOB\n+\n+\t\tcommit refs/heads/S-path-space\n+\t\tmark :301\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitial commit\n+\t\tCOMMIT\n+\t\tM 100644 :401 $path\n+\n+\t\tcommit refs/heads/S-path-space\n+\t\tmark :302\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filecopy source\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tC $path hello2.c\n+\n+\t\tcommit refs/heads/S-path-space\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filerename source\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tR $path hello2.c\n+\n+\t\tEOF\n+\n+\t\tcommit_c=$(grep :302 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_r=$(grep :303 marks.out | cut -d\\  -f2) &&\n+\t\tblob=$(grep :401 marks.out | cut -d\\  -f2) &&\n+\n+\t\t(\n+\t\t\tprintf \"100644 blob $blob\\t$unquoted_path\\n\" &&\n+\t\t\tprintf \"100644 blob $blob\\thello2.c\\n\"\n+\t\t) | sort >tree_c.exp &&\n+\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n+\t\ttest_cmp tree_c.exp tree_c.out &&\n+\n+\t\tprintf \"100644 blob $blob\\thello2.c\\n\" >tree_r.exp &&\n+\t\tgit ls-tree $commit_r >tree_r.out &&\n+\t\ttest_cmp tree_r.exp tree_r.out\n+\t'\n+}\n+\n+test_path_space_success 'quoted spaces'      '\" hello world.c \"'  ' hello world.c '\n+test_path_space_success 'no unquoted spaces' 'hello_world.c'      'hello_world.c'\n+test_path_space_success 'octal escapes'      '\"\\150\\151\\056\\143\"' 'hi.c'\n+\n+#\n+# Test a single commit change with an invalid path. Run it with all occurrences\n+# of <path> in the grammar against all error kinds.\n+#\n+test_path_fail () {\n+\tlocal change=\"$1\" what=\"$2\" prefix=\"$3\" path=\"$4\" suffix=\"$5\" err_grep=\"$6\"\n+\ttest_expect_success \"S: $change with $what must fail\" '\n+\t\ttest_must_fail git fast-import <<-EOF 2>err &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB\n+\t\thello world\n+\t\tBLOB\n+\n+\t\tcommit refs/heads/S-path-fail\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit setup\n+\t\tCOMMIT\n+\t\tM 100644 :1 hello.c\n+\n+\t\tcommit refs/heads/S-path-fail\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit with bad path\n+\t\tCOMMIT\n+\t\tfrom :2\n+\t\t$prefix$path$suffix\n+\t\tEOF\n+\n+\t\ttest_grep \"$err_grep\" err\n+\t'\n+}\n+\n+test_path_base_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\" suffix=\"$4\"\n+\ttest_path_fail \"$change\" 'unclosed \" in '\"$field\"          \"$prefix\" '\"hello.c'    \"$suffix\" \"invalid $field\"\n+\ttest_path_fail \"$change\" \"invalid escape in quoted $field\" \"$prefix\" '\"hello\\xff\"' \"$suffix\" \"invalid $field\"\n+\ttest_path_fail \"$change\" \"escaped NUL in quoted $field\"    \"$prefix\" '\"hello\\000\"' \"$suffix\" \"NUL in $field\"\n+}\n+test_path_eol_quoted_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n+\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ''\n+\ttest_path_fail \"$change\" \"garbage after quoted $field\" \"$prefix\" '\"hello.c\"' 'x' \"garbage after $field\"\n+\ttest_path_fail \"$change\" \"space after quoted $field\"   \"$prefix\" '\"hello.c\"' ' ' \"garbage after $field\"\n+}\n+test_path_eol_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n+\ttest_path_eol_quoted_fail \"$change\" \"$prefix\" \"$field\"\n+}\n+test_path_space_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n+\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ' world.c'\n+\ttest_path_fail \"$change\" \"missing space after quoted $field\"   \"$prefix\" '\"hello.c\"' 'x world.c' \"missing space after $field\"\n+\ttest_path_fail \"$change\" \"missing space after unquoted $field\" \"$prefix\" 'hello.c'   ''          \"missing space after $field\"\n+}\n+\n+test_path_eol_fail   filemodify       'M 100644 :1 ' path\n+test_path_eol_fail   filedelete       'D '           path\n+test_path_space_fail filecopy         'C '           source\n+test_path_eol_fail   filecopy         'C hello.c '   dest\n+test_path_space_fail filerename       'R '           source\n+test_path_eol_fail   filerename       'R hello.c '   dest\n+test_path_eol_fail   'ls (in commit)' 'ls :2 '       path\n+\n+# When 'ls' has no <dataref>, the <path> must be quoted.\n+test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n+\n+test_expect_success 'E: rfc2822 date, --date-format=raw' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main^0\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import --date-format=raw <input\n+\t)\n+'\n+\n+test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main^0\n+\n+\t\tINPUT_END\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --date-format=rfc2822 <input &&\n+\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n+\n+\t\tRFC 2822 type date\n+\t\tEOF\n+\t\tgit cat-file commit main | sed 1,2d >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n+'\n+\n+test_done\ndiff --git a/t/t9308-fast-import-stream.sh b/t/t9308-fast-import-stream.sh\nnew file mode 100755\nindex 0000000000..f8743cbfa4\n--- /dev/null\n+++ b/t/t9308-fast-import-stream.sh\n@@ -0,0 +1,822 @@\n+#!/bin/sh\n+\n+test_description='test fast-import stream handling and output'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'empty stream succeeds' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import </dev/null\n+\t)\n+'\n+\n+test_expect_success 'truncated stream complains' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"tag foo\" | test_must_fail git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print old blob' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 11\n+\t\tyes it can\n+\n+\t\tEOF\n+\t\techo \"cat-blob $blob\" |\n+\t\tgit fast-import --cat-blob-fd=6 6>actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo hello >greeting &&\n+\t\tblob=$(git hash-object -w greeting) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 6\n+\t\thello\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual.3 &&\n+\t\ttest_must_be_empty actual.1 &&\n+\t\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n+\t\toption cat-blob-fd=3\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_must_be_empty actual.3 &&\n+\t\ttest_cmp expect actual.1\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print mark for new blob' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"effluentish\" | git hash-object --stdin >expect &&\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\teffluentish\n+\t\tBLOB_END\n+\t\tget-mark :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print new blob' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 12\n+\t\tyep yep yep\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\tyep yep yep\n+\t\tBLOB_END\n+\t\tcat-blob :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print new blob by sha1' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 25\n+\t\ta new blob named by sha1\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n+\t\tblob\n+\t\tdata <<BLOB_END\n+\t\ta new blob named by sha1\n+\t\tBLOB_END\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+setup_big_file () {\n+\t(\n+\t\techo \"the quick brown fox jumps over the lazy dog\" >big &&\n+\t\tfor i in 1 2 3\n+\t\tdo\n+\t\t\tcat big big big big >bigger &&\n+\t\t\tcat bigger bigger bigger bigger >big ||\n+\t\t\texit\n+\t\tdone\n+\t)\n+}\n+\n+test_expect_success 'R: print two blobs to stdout' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsetup_big_file &&\n+\t\tblob1=$(git hash-object big) &&\n+\t\tblob1_len=$(wc -c <big) &&\n+\t\tblob2=$(echo hello | git hash-object --stdin) &&\n+\t\t{\n+\t\t\techo ${blob1} blob $blob1_len &&\n+\t\t\tcat big &&\n+\t\t\tcat <<-EOF\n+\n+\t\t\t${blob2} blob 6\n+\t\t\thello\n+\n+\t\t\tEOF\n+\t\t} >expect &&\n+\t\t{\n+\t\t\tcat <<-\\END_PART1 &&\n+\t\t\t\tblob\n+\t\t\t\tmark :1\n+\t\t\t\tdata <<data_end\n+\t\t\tEND_PART1\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF\n+\t\t\t\tdata_end\n+\t\t\t\tblob\n+\t\t\t\tmark :2\n+\t\t\t\tdata <<data_end\n+\t\t\t\thello\n+\t\t\t\tdata_end\n+\t\t\t\tcat-blob :1\n+\t\t\t\tcat-blob :2\n+\t\t\tEOF\n+\t\t} |\n+\t\tgit fast-import >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success PIPE 'R: copy using cat-file' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsetup_big_file &&\n+\t\texpect_id=$(git hash-object big) &&\n+\t\texpect_len=$(wc -c <big) &&\n+\t\techo $expect_id blob $expect_len >expect.response &&\n+\n+\t\trm -f blobs &&\n+\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tBLOB\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\techo \"$blob_id $type $size\" >response &&\n+\t\t\ttest_copy_bytes $size >blob <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\tcat <<-EOF &&\n+\t\t\tcommit refs/heads/copied\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tcopy big file as file3\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline file3\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat blob &&\n+\t\t\techo BLOB\n+\t\t) 3<blobs |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\tgit show copied:file3 >actual &&\n+\t\ttest_cmp expect.response response &&\n+\t\ttest_cmp big actual\n+\t)\n+'\n+\n+test_expect_success PIPE 'R: print blob mid-commit' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _before_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _before_ the commit.\n+\t\t\tBLOB\n+\t\t\tcommit refs/heads/temporary\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success PIPE 'R: print staged blob within commit' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _within_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tcommit refs/heads/within\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline within\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _within_ the commit.\n+\t\t\tBLOB\n+\t\t\tEOF\n+\n+\t\t\tto_get=$(\n+\t\t\t\techo \"A blob from _within_ the commit.\" |\n+\t\t\t\tgit hash-object --stdin\n+\t\t\t) &&\n+\t\t\techo \"cat-blob $to_get\" &&\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo deleteall\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'R: quiet option results in no stats being output' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\toption git quiet\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\n+\t\tgit fast-import 2>output <input &&\n+\t\ttest_must_be_empty output\n+\t)\n+'\n+\n+test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo feature done | test_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --done </dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import <<-\\EOF &&\n+\t\tfeature done\n+\t\tdone\n+\t\ttrailing gibberish\n+\t\tEOF\n+\t\tgit fast-import <<-\\EOF\n+\t\tdone\n+\t\tmore trailing gibberish\n+\t\tEOF\n+\t)\n+'\n+\n+test_expect_success 'R: terminating \"done\" within commit' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >expect <<-\\EOF &&\n+\t\tOBJID\n+\t\t:000000 100644 OBJID OBJID A\thello.c\n+\t\t:000000 100644 OBJID OBJID A\thello2.c\n+\t\tEOF\n+\t\tgit fast-import <<-EOF &&\n+\t\tcommit refs/heads/done-ends\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<EOT\n+\t\tCommit terminated by \"done\" command\n+\t\tEOT\n+\t\tM 100644 inline hello.c\n+\t\tdata <<EOT\n+\t\tHello, world.\n+\t\tEOT\n+\t\tC hello.c hello2.c\n+\t\tdone\n+\t\tEOF\n+\t\tgit rev-list done-ends |\n+\t\tgit diff-tree -r --stdin --root --always |\n+\t\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+setup_import_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tgit -C repo config fastimport.unpackLimit 0 &&\n+\tmkdir repo/file2 &&\n+\techo abcd >repo/file2/file4 &&\n+\tgit -C repo add file2/file4 &&\n+\ttest_tick &&\n+\tgit -C repo commit -m base\n+}\n+\n+import_reference_commit () {\n+\tgit fast-import <<-INPUT_END\n+\tcommit refs/heads/$1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tdirty directory copy\n+\tCOMMIT\n+\n+\tfrom refs/heads/main\n+\tM 644 inline file2/file5\n+\tdata <<EOF\n+\tan inline file.\n+\t  we should see it later.\n+\tEOF\n+\n+\tC file2 file3\n+\tD file2/file5\n+\n+\tINPUT_END\n+}\n+\n+test_expect_success 'O: comments are all skipped' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\t#we will\n+\t\tcommit refs/heads/O1\n+\t\t# -- ignore all of this text\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\n+\t\t# do not forget the import blank line!\n+\t\t#\n+\t\t# yes, we started from our usual base of main.\n+\t\t# i like main.\n+\t\tfrom refs/heads/main\n+\t\t# and we need to add file2/file5 to file2.\n+\t\tM 644 inline file2/file5\n+\t\t# otherwise the tree will be different\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\n+\t\t# do not forget to copy file2 to file3\n+\t\tC file2 file3\n+\t\t#\n+\t\t# or to delete file5 from file2.\n+\t\tD file2/file5\n+\t\t# are we done yet?\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O1 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O1-reference &&\n+\t\ttest_cmp_rev O1-reference O1\n+\t)\n+'\n+\n+test_expect_success 'O: blank lines not necessary after data commands' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\t\tfrom refs/heads/main\n+\t\tM 644 inline file2/file5\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\t\tC file2 file3\n+\t\tD file2/file5\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O2 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O2-reference &&\n+\t\ttest_cmp_rev O2-reference O2\n+\t)\n+'\n+\n+test_expect_success 'O: blank lines not necessary after other commands' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tgit repack -a -d &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tmark :5\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\treset refs/tags/O3-2nd\n+\t\tfrom :5\n+\t\treset refs/tags/O3-3rd\n+\t\tfrom :5\n+\t\tINPUT_END\n+\n+\t\tcat >expect <<-INPUT_END &&\n+\t\tstring\n+\t\tof\n+\t\tempty\n+\t\tcommits\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tls -la .git/objects/pack/pack-*.pack >packlist &&\n+\t\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n+\t\ttest_line_count = 4 idxlist &&\n+\t\ttest_line_count = 4 packlist &&\n+\t\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n+\t\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'O: progress outputs as requested by input' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tprogress Two commits down, 2 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tprogress Three commits down, 1 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\tprogress done!\n+\t\tINPUT_END\n+\t\tgit fast-import <input >actual &&\n+\t\tgrep \"progress \" <input >expect &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+##\n+## R: very large blobs\n+##\n+test_expect_success 'R: blob bigger than threshold' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblobsize=$((2*1024*1024 + 53)) &&\n+\t\ttest-tool genrandom bar $blobsize >expect &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/big-file\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tR - big file\n+\t\tCOMMIT\n+\n+\t\tM 644 inline big1\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\tcat >>input <<-INPUT_END &&\n+\t\tM 644 inline big2\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\techo >>input &&\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --big-file-threshold=1 <input &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack -v \"$p\" || return 1\n+\t\tdone >verify &&\n+\n+\t\tgit cat-file blob big-file:big1 >actual &&\n+\t\ttest_cmp_bin expect actual &&\n+\t\ta=$(git rev-parse big-file:big1) &&\n+\t\tb=$(git rev-parse big-file:big2) &&\n+\t\ttest $a = $b &&\n+\t\tn=$(grep $a verify | wc -l) &&\n+\t\ttest 1 = $n\n+\t)\n+'\n+\n+w_input () {\n+\tcat <<-W_INPUT_END\n+\tcommit refs/heads/W-branch\n+\tmark :1\n+\tauthor Full Name <user@company.tld> 1000000000 +0100\n+\tcommitter Full Name <user@company.tld> 1000000000 +0100\n+\tdata 27\n+\tIntentionally empty commit\n+\tLFsget-mark :1\n+\tW_INPUT_END\n+}\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs// | tr L \"\\n\" | git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs/L/ | tr L \"\\n\" | git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# Technically, this should fail as it has too many linefeeds\n+\t\t# according to the grammar in fast-import.txt.  But, for whatever\n+\t\t# reason, it works.  Since using the correct number of newlines\n+\t\t# does not work with older (pre-2.22) versions of git, allow apps\n+\t\t# that used this second-newline workaround to keep working by\n+\t\t# checking it with this test...\n+\t\tw_input | sed -e s/LFs/LL/ | tr L \"\\n\" | git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# ...but do NOT allow more empty lines than that (see previous test).\n+\t\tw_input | sed -e s/LFs/LLL/ | tr L \"\\n\" | test_must_fail git fast-import\n+\t)\n+'\n+\n+test_expect_success ICONV 'X: handling encoding' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/encoding\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tencoding iso-8859-7\n+\t\tdata <<COMMIT\n+\t\tINPUT_END\n+\n+\t\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n+\n+\t\tgit fast-import <input &&\n+\t\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n+\t\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n+\t)\n+'\n+\n+test_expect_success 'X: replace ref that becomes useless is removed' '\n+\ttest_when_finished \"rm -rf testrepo\" &&\n+\tgit init -qb main testrepo &&\n+\t(\n+\t\tcd testrepo &&\n+\t\ttest_commit test &&\n+\n+\t\ttest_commit msg somename content &&\n+\n+\t\tgit mv somename othername &&\n+\t\tNEW_TREE=$(git write-tree) &&\n+\t\tMSG=\"$(git log -1 --format=%B HEAD)\" &&\n+\t\tNEW_COMMIT=$(git commit-tree -p HEAD^1 -m \"$MSG\" $NEW_TREE) &&\n+\t\tgit replace main $NEW_COMMIT &&\n+\n+\t\techo more >>othername &&\n+\t\tgit add othername &&\n+\t\tgit commit -qm more &&\n+\n+\t\tgit fast-export --all >tmp &&\n+\t\tsed -e s/othername/somename/ tmp >tmp2 &&\n+\t\tgit fast-import --force <tmp2 2>msgs &&\n+\n+\t\ttest_grep \"dropping.*since it would point to itself\" msgs &&\n+\t\tgit show-ref >refs &&\n+\t\ttest_grep ! refs/replace refs\n+\t)\n+'\n+\n+for root in '\"\"' ''\n+do\n+\ttest_expect_success \"T: ls root ($root) tree\" '\n+\t\ttest_when_finished \"rm -rf repo\" &&\n+\t\tgit init repo &&\n+\t\t(\n+\t\t\tcd repo &&\n+\t\t\ttest_commit one &&\n+\n+\t\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n+\t\t\t040000 tree $(git rev-parse HEAD^{tree})\tZ\n+\t\t\tEOF\n+\t\t\tsha1=$(git rev-parse --verify HEAD) &&\n+\t\t\tgit fast-import <<-EOF >actual &&\n+\t\t\tls $sha1 $root\n+\t\t\tEOF\n+\t\t\ttest_cmp expect actual\n+\t\t)\n+\t'\n+done\n+\n+test_expect_success 'I: export-pack-edges' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init -b main repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/export-boundary\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\twe have a border.  its only 40 characters wide.\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n+\t\t\t--export-pack-edges=edges.list <input &&\n+\n+\t\t# verify edge list\n+\t\tcat >expect <<-EOF &&\n+\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n+\t\tEOF\n+\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_done\ndiff --git a/t/t9309-fast-import-checkpoint.sh b/t/t9309-fast-import-checkpoint.sh\nnew file mode 100755\nindex 0000000000..64674dcf83\n--- /dev/null\n+++ b/t/t9309-fast-import-checkpoint.sh\n@@ -0,0 +1,188 @@\n+#!/bin/sh\n+\n+test_description='test fast-import checkpoint handling'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+# The commands in input_file should not produce any output on the file\n+# descriptor set with --cat-blob-fd (or stdout if unspecified).\n+#\n+# To make sure you're observing the side effects of checkpoint *before*\n+# fast-import terminates (and thus writes out its state), check that the\n+# fast-import process is still running using background_import_still_running\n+# *after* evaluating the test conditions.\n+background_import_then_checkpoint () {\n+\toptions=$1\n+\tinput_file=$2\n+\n+\tmkfifo V.input\n+\texec 8<>V.input\n+\trm V.input\n+\n+\tmkfifo V.output\n+\texec 9<>V.output\n+\trm V.output\n+\n+\t(\n+\t\tgit -C repo fast-import $options <&8 >&9 &\n+\t\techo $! >&9\n+\t\twait $!\n+\t\techo >&2 \"background fast-import terminated too early with exit code $?\"\n+\t\t# Un-block the read loop in the main shell process.\n+\t\techo >&9 UNEXPECTED\n+\t) &\n+\tsh_pid=$!\n+\tread fi_pid <&9\n+\t# We don't mind if fast-import has already died by the time the test\n+\t# ends.\n+\ttest_when_finished \"\n+\t\texec 8>&-; exec 9>&-;\n+\t\tkill $sh_pid && wait $sh_pid\n+\t\tkill $fi_pid && wait $fi_pid\n+\t\ttrue\"\n+\n+\t# Start in the background to ensure we adhere strictly to (blocking)\n+\t# pipes writing sequence. We want to assume that the write below could\n+\t# block, e.g. if fast-import blocks writing its own output to &9\n+\t# because there is no reader on &9 yet.\n+\t(\n+\t\tcat \"$input_file\"\n+\t\techo \"checkpoint\"\n+\t\techo \"progress checkpoint\"\n+\t) >&8 &\n+\n+\tlast=$(\n+\t\twhile read output <&9\n+\t\tdo\n+\t\t\tif test \"$output\" = \"progress checkpoint\" || test \"$output\" = \"UNEXPECTED\"\n+\t\t\tthen\n+\t\t\t\techo \"$output\"\n+\t\t\t\tbreak\n+\t\t\telse\n+\t\t\t\t# otherwise ignore cruft\n+\t\t\t\techo >&2 \"cruft: $output\"\n+\t\t\tfi\n+\t\tdone\n+\t)\n+\n+\ttest \"$last\" = \"progress checkpoint\"\n+}\n+\n+background_import_still_running () {\n+\tif ! kill -0 \"$fi_pid\"\n+\tthen\n+\t\techo >&2 \"background fast-import terminated too early\"\n+\t\tfalse\n+\tfi\n+}\n+\n+setup_checkpoint_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_tick &&\n+\tgit -C repo fast-import <<-INPUT_END\n+\tcommit refs/heads/base\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tbase commit\n+\tCOMMIT\n+\tINPUT_END\n+}\n+\n+test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n+\tprogress foo\n+\tprogress bar\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\tbackground_import_still_running\n+'\n+\n+test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-\\INPUT_END &&\n+\treset refs/heads/V\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\ttest \"$(git -C repo rev-parse --verify V)\" = \"$(git -C repo rev-parse --verify base)\" &&\n+\tbackground_import_still_running\n+'\n+\n+test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n+\tcommit refs/heads/V\n+\tmark :1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n+\n+\t\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify base)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n+\tbackground_import_still_running\n+'\n+\n+# Re-create the exact same commit, but on a different branch: no new object is\n+# created in the database, but the refs and marks still need to be updated.\n+test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n+\tsetup_checkpoint_repo &&\n+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n+\tcommit refs/heads/V\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tcat >repo/input <<-INPUT_END &&\n+\tcommit refs/heads/V2\n+\tmark :2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n+\n+\t\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n+\tbackground_import_still_running\n+'\n+\n+test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n+\ttag Vtag\n+\tfrom refs/heads/base\n+\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\tgit -C repo show-ref -d Vtag &&\n+\tbackground_import_still_running\n+'\n+\n+test_done\ndiff --git a/t/t9310-fast-import-submodule.sh b/t/t9310-fast-import-submodule.sh\nnew file mode 100755\nindex 0000000000..6e7dbda9f9\n--- /dev/null\n+++ b/t/t9310-fast-import-submodule.sh\n@@ -0,0 +1,341 @@\n+#!/bin/sh\n+\n+test_description='test fast-import with submodules and gitlinks'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+setup_gitlinks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo base &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 10\n+\t\ttest file\n+\n+\t\treset refs/heads/sub\n+\t\tcommit refs/heads/sub\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 12\n+\t\tsub_initial\n+\t\tM 100644 :1 file\n+\n+\t\tblob\n+\t\tmark :3\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :3 .gitmodules\n+\t\tM 160000 :2 sub\n+\n+\t\tblob\n+\t\tmark :5\n+\t\tdata 20\n+\t\ttest file\n+\t\tmore data\n+\n+\t\tcommit refs/heads/sub\n+\t\tmark :6\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 11\n+\t\tsub_second\n+\t\tfrom :2\n+\t\tM 100644 :5 file\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :7\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :4\n+\t\tM 160000 :6 sub\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input\n+\t)\n+}\n+\n+test_expect_success 'P: superproject & submodule mix' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit checkout subuse1 &&\n+\t\trm -rf sub &&\n+\t\tmkdir sub &&\n+\t\t(\n+\t\t\tcd sub &&\n+\t\t\tgit init &&\n+\t\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n+\t\t\tgit checkout main\n+\t\t) &&\n+\t\tgit submodule init &&\n+\t\tgit submodule update\n+\t)\n+'\n+\n+test_expect_success 'P: verbatim SHA gitlinks' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tSUBLAST=$(git rev-parse --verify sub) &&\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n+\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :1 .gitmodules\n+\t\tM 160000 $SUBPREV sub\n+\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :2\n+\t\tM 160000 $SUBLAST sub\n+\n+\t\tINPUT_END\n+\n+\t\tgit branch -D sub &&\n+\t\tgit gc --prune=now &&\n+\t\tgit fast-import <input &&\n+\t\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n+\t)\n+'\n+\n+test_expect_success 'P: fail on inline gitlink' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 inline sub\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'P: fail on blob mark in gitlink' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n+\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 :1 sub\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+cat >Y-sub-input <<\\Y_INPUT_END\n+blob\n+mark :1\n+data 4\n+foo\n+\n+reset refs/heads/main\n+commit refs/heads/main\n+mark :2\n+author Full Name <user@company.tld> 1000000000 +0100\n+committer Full Name <user@company.tld> 1000000000 +0100\n+data 24\n+Test submodule commit 1\n+M 100644 :1 file\n+\n+blob\n+mark :3\n+data 8\n+foo\n+bar\n+\n+commit refs/heads/main\n+mark :4\n+author Full Name <user@company.tld> 1000000001 +0100\n+committer Full Name <user@company.tld> 1000000001 +0100\n+data 24\n+Test submodule commit 2\n+from :2\n+M 100644 :3 file\n+Y_INPUT_END\n+\n+# Note that the submodule object IDs are intentionally not translated.\n+cat >Y-main-input <<\\Y_INPUT_END\n+blob\n+mark :1\n+data 4\n+foo\n+\n+reset refs/heads/main\n+commit refs/heads/main\n+mark :2\n+author Full Name <user@company.tld> 2000000000 +0100\n+committer Full Name <user@company.tld> 2000000000 +0100\n+data 14\n+Test commit 1\n+M 100644 :1 file\n+\n+blob\n+mark :3\n+data 73\n+[submodule \"sub1\"]\n+\tpath = sub1\n+\turl = https://void.example.com/main.git\n+\n+commit refs/heads/main\n+mark :4\n+author Full Name <user@company.tld> 2000000001 +0100\n+committer Full Name <user@company.tld> 2000000001 +0100\n+data 14\n+Test commit 2\n+from :2\n+M 100644 :3 .gitmodules\n+M 160000 0712c5be7cf681388e355ef47525aaf23aee1a6d sub1\n+\n+blob\n+mark :5\n+data 8\n+foo\n+bar\n+\n+commit refs/heads/main\n+mark :6\n+author Full Name <user@company.tld> 2000000002 +0100\n+committer Full Name <user@company.tld> 2000000002 +0100\n+data 14\n+Test commit 3\n+from :4\n+M 100644 :5 file\n+M 160000 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7 sub1\n+Y_INPUT_END\n+\n+cat >Y-marks <<\\Y_INPUT_END\n+:2 0712c5be7cf681388e355ef47525aaf23aee1a6d\n+:4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n+Y_INPUT_END\n+\n+test_expect_success 'Y: rewrite submodules' '\n+\ttest_when_finished \"rm -rf main1\" &&\n+\ttest_oid_cache <<-EOF &&\n+\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n+\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n+\tEOF\n+\tgit init main1 &&\n+\t(\n+\t\tcd main1 &&\n+\t\tgit init sub2 &&\n+\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n+\t\tgit fast-import --rewrite-submodules-from=sub:../Y-marks \\\n+\t\t\t--rewrite-submodules-to=sub:sub2-marks <../Y-main-input &&\n+\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n+\t)\n+'\n+\n+test_expect_success 'Y: reference pending tag or commit' '\n+\ttest_oid_cache <<-EOF &&\n+\tpending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04\n+\tpending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d\n+\tpending_tag sha1:ec6c4db71feb5f66615214dad2324ce030e777a7\n+\tpending_tag sha256:85edc5eac315bc680677b2fc71622bd77476f057eb8dc8ed6a497803a24f1f46\n+\tEOF\n+\n+\ttest_when_finished \"rm -rf reference-pending\" &&\n+\tgit init reference-pending &&\n+\t(\n+\t\tcd reference-pending &&\n+\t\tgit fast-import <<-EOF\n+\t\tcommit refs/heads/main\n+\t\tcommitter A U Thor <author@example.com> 1712563200 +0000\n+\t\tdata 14\n+\t\tcommit message\n+\t\tM 644 inline test file\n+\t\tdata 14\n+\t\tdummy content\n+\n+\t\ttag newtag\n+\t\tfrom $(test_oid pending_commit)\n+\t\ttagger A U Thor <author@example.com> 1712563300 +0000\n+\t\tdata 11\n+\t\ttag message\n+\t\t# no emty line after tag data!\n+\t\treset refs/heads/other\n+\t\tfrom $(test_oid pending_tag)\n+\n+\t\tcommit refs/heads/further\n+\t\tcommitter A U Thor <author@example.com> 1712563400 +0000\n+\t\tdata 21\n+\t\twhat about 2nd commit\n+\t\tfrom $(test_oid pending_commit)\n+\t\tM 644 inline other test file\n+\t\tdata 19\n+\t\tmore dummy content\n+\n+\t\tdone\n+\t\tEOF\n+\t)\n+'\n+\n+test_done\ndiff --git a/t/t9311-fast-import-refs.sh b/t/t9311-fast-import-refs.sh\nnew file mode 100755\nindex 0000000000..2bb8ac1d46\n--- /dev/null\n+++ b/t/t9311-fast-import-refs.sh\n@@ -0,0 +1,194 @@\n+#!/bin/sh\n+\n+test_description='test fast-import ref updates'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+setup_two_commit_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo one &&\n+\ttest_commit -C repo two\n+}\n+\n+test_expect_success 'F: non-fast-forward update skips' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main~1\n+\n+\t\treset refs/heads/other\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git -c fastimport.unpackLimit=0 fast-import <input &&\n+\t\t# branch must remain unaffected\n+\t\ttest $old_branch = $(git rev-parse --verify main^0) &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone &&\n+\n+\t\tcat >expect <<-EOF &&\n+\t\ttree $(git rev-parse main~1^{tree})\n+\t\tparent $(git rev-parse main~1)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tlosing things already?\n+\t\tEOF\n+\t\tgit cat-file commit other >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'G: non-fast-forward update forced' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main~1\n+\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --force <input &&\n+\t\t# branch changed, but logged\n+\t\ttest $old_branch != $(git rev-parse --verify main^0) &&\n+\t\ttest $old_branch = $(git rev-parse --verify main@{1}) &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n+'\n+\n+test_expect_success 'J: reset existing branch creates empty commit' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate J\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\treset refs/heads/J\n+\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitialize J\n+\t\tCOMMIT\n+\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# branch has 1 commit, empty tree\n+\t\ttest 1 = $(git rev-list J | wc -l) &&\n+\t\ttest 0 = $(git ls-tree J | wc -l)\n+\t)\n+'\n+\n+test_expect_success 'J: tag must fail on empty branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\treset refs/heads/J2\n+\n+\t\ttag wrong_tag\n+\t\tfrom refs/heads/J2\n+\t\tdata <<EOF\n+\t\tTag branch that was reset.\n+\t\tEOF\n+\t\tINPUT_END\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'K: reinit branch with from' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate K\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tredo K\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main^1\n+\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# K^1 = main^1\n+\t\ttest $(git rev-parse --verify main^1) \\\n+\t\t\t= $(git rev-parse --verify K^1)\n+\t)\n+'\n+\n+test_expect_success 'T: delete branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/to-delete\n+\t\tfrom $ZERO_OID\n+\t\tEOF\n+\t\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n+\t)\n+'\n+\n+test_expect_success 'T: empty reset doesnt delete branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch not-to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/not-to-delete\n+\t\tEOF\n+\t\tgit show-ref &&\n+\t\tgit rev-parse --verify refs/heads/not-to-delete\n+\t)\n+'\n+\n+test_done\n\n-- \n2.56.GIT\n\n\n"},{"id":"558074","messageId":"20261110-kn-fast-import-tests-1-v1-20-dbd9ee502aae@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH 20/20] t93xx: drop the series letter from the moved test names","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-10T11:50:05Z","receivedAt":"2026-11-10T11:50:05Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"In the previous commits, tests were moved from t9300 to other test\nfiles as is. Each of these tests have their descriptions prefixed with\ntheir series names. Since they don't hold any value outside of t9300,\ndrop them.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9301-fast-import-notes.sh      | 42 ++++++++---------\n t/t9304-fast-import-marks.sh      | 28 ++++++------\n t/t9307-fast-import-validation.sh | 96 +++++++++++++++++++--------------------\n t/t9308-fast-import-stream.sh     | 52 ++++++++++-----------\n t/t9309-fast-import-checkpoint.sh | 10 ++--\n t/t9310-fast-import-submodule.sh  | 12 ++---\n t/t9311-fast-import-refs.sh       | 14 +++---\n 7 files changed, 127 insertions(+), 127 deletions(-)\n\ndiff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh\nindex 5d43a523d0..89078b6527 100755\n--- a/t/t9301-fast-import-notes.sh\n+++ b/t/t9301-fast-import-notes.sh\n@@ -860,7 +860,7 @@ echo \\\"\\$@\\\"\" &&\n \tcommit3=$(git -C repo rev-parse notes-test)\n }\n \n-test_expect_success 'Q: verify pack' '\n+test_expect_success 'verify pack' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -871,7 +871,7 @@ test_expect_success 'Q: verify pack' '\n \t)\n '\n \n-test_expect_success 'Q: verify first commit' '\n+test_expect_success 'verify first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -886,7 +886,7 @@ test_expect_success 'Q: verify first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify second commit' '\n+test_expect_success 'verify second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -902,7 +902,7 @@ test_expect_success 'Q: verify second commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify third commit' '\n+test_expect_success 'verify third commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -918,7 +918,7 @@ test_expect_success 'Q: verify third commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first notes commit' '\n+test_expect_success 'verify first notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -933,7 +933,7 @@ test_expect_success 'Q: verify first notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first notes tree' '\n+test_expect_success 'verify first notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -947,7 +947,7 @@ test_expect_success 'Q: verify first notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for first commit' '\n+test_expect_success 'verify first note for first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -957,7 +957,7 @@ test_expect_success 'Q: verify first note for first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for second commit' '\n+test_expect_success 'verify first note for second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -967,7 +967,7 @@ test_expect_success 'Q: verify first note for second commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for third commit' '\n+test_expect_success 'verify first note for third commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -977,7 +977,7 @@ test_expect_success 'Q: verify first note for third commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify second notes commit' '\n+test_expect_success 'verify second notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -993,7 +993,7 @@ test_expect_success 'Q: verify second notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify second notes tree' '\n+test_expect_success 'verify second notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1007,7 +1007,7 @@ test_expect_success 'Q: verify second notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify second note for first commit' '\n+test_expect_success 'verify second note for first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1017,7 +1017,7 @@ test_expect_success 'Q: verify second note for first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for second commit' '\n+test_expect_success 'verify first note for second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1027,7 +1027,7 @@ test_expect_success 'Q: verify first note for second commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for third commit' '\n+test_expect_success 'verify first note for third commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1037,7 +1037,7 @@ test_expect_success 'Q: verify first note for third commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify third notes commit' '\n+test_expect_success 'verify third notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1052,7 +1052,7 @@ test_expect_success 'Q: verify third notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify third notes tree' '\n+test_expect_success 'verify third notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1064,7 +1064,7 @@ test_expect_success 'Q: verify third notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify third note for first commit' '\n+test_expect_success 'verify third note for first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1074,7 +1074,7 @@ test_expect_success 'Q: verify third note for first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify fourth notes commit' '\n+test_expect_success 'verify fourth notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1090,7 +1090,7 @@ test_expect_success 'Q: verify fourth notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify fourth notes tree' '\n+test_expect_success 'verify fourth notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1102,7 +1102,7 @@ test_expect_success 'Q: verify fourth notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify second note for second commit' '\n+test_expect_success 'verify second note for second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1112,7 +1112,7 @@ test_expect_success 'Q: verify second note for second commit' '\n \t)\n '\n \n-test_expect_success 'Q: deny note on empty branch' '\n+test_expect_success 'deny note on empty branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\ndiff --git a/t/t9304-fast-import-marks.sh b/t/t9304-fast-import-marks.sh\nindex 437f9016fa..57050dcfe4 100755\n--- a/t/t9304-fast-import-marks.sh\n+++ b/t/t9304-fast-import-marks.sh\n@@ -79,7 +79,7 @@ test_expect_success 'relative marks are not affected by subdir' '\n \ttest_path_is_file deep-relative/.git/info/fast-import/exported-marks\n '\n \n-test_expect_success 'R: export-marks feature results in a marks file being created' '\n+test_expect_success 'export-marks feature results in a marks file being created' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -99,7 +99,7 @@ test_expect_success 'R: export-marks feature results in a marks file being creat\n \t)\n '\n \n-test_expect_success 'R: export-marks options can be overridden by commandline options' '\n+test_expect_success 'export-marks options can be overridden by commandline options' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -120,7 +120,7 @@ test_expect_success 'R: export-marks options can be overridden by commandline op\n \t)\n '\n \n-test_expect_success 'R: catch typo in marks file name' '\n+test_expect_success 'catch typo in marks file name' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -132,7 +132,7 @@ test_expect_success 'R: catch typo in marks file name' '\n \t)\n '\n \n-test_expect_success 'R: import and output marks can be the same file' '\n+test_expect_success 'import and output marks can be the same file' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -162,7 +162,7 @@ test_expect_success 'R: import and output marks can be the same file' '\n \t)\n '\n \n-test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n+test_expect_success '--import-marks=foo --output-marks=foo to create foo fails' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -179,7 +179,7 @@ test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fail\n \t)\n '\n \n-test_expect_success 'R: --import-marks-if-exists' '\n+test_expect_success '--import-marks-if-exists' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -199,7 +199,7 @@ test_expect_success 'R: --import-marks-if-exists' '\n \t)\n '\n \n-test_expect_success 'R: feature import-marks-if-exists' '\n+test_expect_success 'feature import-marks-if-exists' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -253,7 +253,7 @@ test_expect_success 'R: feature import-marks-if-exists' '\n \t)\n '\n \n-test_expect_success 'R: corrupt lines do not mess marks file' '\n+test_expect_success 'corrupt lines do not mess marks file' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -315,7 +315,7 @@ create_marks_file () {\n \tEOF\n }\n \n-test_expect_success 'R: import to output marks works without any content' '\n+test_expect_success 'import to output marks works without any content' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -332,7 +332,7 @@ test_expect_success 'R: import to output marks works without any content' '\n \t)\n '\n \n-test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n+test_expect_success 'import marks prefers commandline marks file over the stream' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -349,7 +349,7 @@ test_expect_success 'R: import marks prefers commandline marks file over the str\n \t)\n '\n \n-test_expect_success 'R: multiple --import-marks= should be honoured' '\n+test_expect_success 'multiple --import-marks= should be honoured' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -369,7 +369,7 @@ test_expect_success 'R: multiple --import-marks= should be honoured' '\n \t)\n '\n \n-test_expect_success 'R: feature relative-marks should be honoured' '\n+test_expect_success 'feature relative-marks should be honoured' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -389,7 +389,7 @@ test_expect_success 'R: feature relative-marks should be honoured' '\n \t)\n '\n \n-test_expect_success 'R: feature no-relative-marks should be honoured' '\n+test_expect_success 'feature no-relative-marks should be honoured' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -410,7 +410,7 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '\n \t)\n '\n \n-test_expect_success 'A: export marks with large values' '\n+test_expect_success 'export marks with large values' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\ndiff --git a/t/t9307-fast-import-validation.sh b/t/t9307-fast-import-validation.sh\nindex e52ae3326f..ec551e2487 100755\n--- a/t/t9307-fast-import-validation.sh\n+++ b/t/t9307-fast-import-validation.sh\n@@ -6,7 +6,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n \n . ./test-lib.sh\n \n-test_expect_success 'B: fail on invalid blob sha1' '\n+test_expect_success 'fail on invalid blob sha1' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -31,7 +31,7 @@ test_expect_success 'B: fail on invalid blob sha1' '\n \t)\n '\n \n-test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n+test_expect_success 'accept branch name \"TEMP_TAG\"' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -55,7 +55,7 @@ test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n \t)\n '\n \n-test_expect_success 'B: accept empty committer' '\n+test_expect_success 'accept empty committer' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -75,7 +75,7 @@ test_expect_success 'B: accept empty committer' '\n \t)\n '\n \n-test_expect_success 'B: reject invalid timezone' '\n+test_expect_success 'reject invalid timezone' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -93,7 +93,7 @@ test_expect_success 'B: reject invalid timezone' '\n \t)\n '\n \n-test_expect_success 'B: accept invalid timezone with raw-permissive' '\n+test_expect_success 'accept invalid timezone with raw-permissive' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -113,7 +113,7 @@ test_expect_success 'B: accept invalid timezone with raw-permissive' '\n \t)\n '\n \n-test_expect_success 'B: accept and fixup committer with no name' '\n+test_expect_success 'accept and fixup committer with no name' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -133,7 +133,7 @@ test_expect_success 'B: accept and fixup committer with no name' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (1)' '\n+test_expect_success 'fail on invalid committer (1)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -151,7 +151,7 @@ test_expect_success 'B: fail on invalid committer (1)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (2)' '\n+test_expect_success 'fail on invalid committer (2)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -169,7 +169,7 @@ test_expect_success 'B: fail on invalid committer (2)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (3)' '\n+test_expect_success 'fail on invalid committer (3)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -187,7 +187,7 @@ test_expect_success 'B: fail on invalid committer (3)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (4)' '\n+test_expect_success 'fail on invalid committer (4)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -205,7 +205,7 @@ test_expect_success 'B: fail on invalid committer (4)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (5)' '\n+test_expect_success 'fail on invalid committer (5)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -223,7 +223,7 @@ test_expect_success 'B: fail on invalid committer (5)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of ..' '\n+test_expect_success 'fail on invalid file path of ..' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -248,7 +248,7 @@ test_expect_success 'B: fail on invalid file path of ..' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of .' '\n+test_expect_success 'fail on invalid file path of .' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -280,7 +280,7 @@ test_expect_success 'B: fail on invalid file path of .' '\n \t)\n '\n \n-test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n+test_expect_success WINDOWS 'fail on invalid file path of C:' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -305,7 +305,7 @@ test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of .git' '\n+test_expect_success 'fail on invalid file path of .git' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -330,7 +330,7 @@ test_expect_success 'B: fail on invalid file path of .git' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of .gitmodules' '\n+test_expect_success 'fail on invalid file path of .gitmodules' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -355,7 +355,7 @@ test_expect_success 'B: fail on invalid file path of .gitmodules' '\n \t)\n '\n \n-test_expect_success 'R: abort on unsupported feature' '\n+test_expect_success 'abort on unsupported feature' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -369,7 +369,7 @@ test_expect_success 'R: abort on unsupported feature' '\n \t)\n '\n \n-test_expect_success 'R: supported feature is accepted' '\n+test_expect_success 'supported feature is accepted' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -383,7 +383,7 @@ test_expect_success 'R: supported feature is accepted' '\n \t)\n '\n \n-test_expect_success 'R: abort on receiving feature after data command' '\n+test_expect_success 'abort on receiving feature after data command' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -400,7 +400,7 @@ test_expect_success 'R: abort on receiving feature after data command' '\n \t)\n '\n \n-test_expect_success 'R: import-marks features forbidden by default' '\n+test_expect_success 'import-marks features forbidden by default' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -414,7 +414,7 @@ test_expect_success 'R: import-marks features forbidden by default' '\n \t)\n '\n \n-test_expect_success 'R: only one import-marks feature allowed per stream' '\n+test_expect_success 'only one import-marks feature allowed per stream' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -431,7 +431,7 @@ test_expect_success 'R: only one import-marks feature allowed per stream' '\n \t)\n '\n \n-test_expect_success 'R: export-marks feature forbidden by default' '\n+test_expect_success 'export-marks feature forbidden by default' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -442,7 +442,7 @@ test_expect_success 'R: export-marks feature forbidden by default' '\n \t)\n '\n \n-test_expect_success 'R: feature ls supported' '\n+test_expect_success 'feature ls supported' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -453,7 +453,7 @@ test_expect_success 'R: feature ls supported' '\n \t)\n '\n \n-test_expect_success 'R: feature cat-blob supported' '\n+test_expect_success 'feature cat-blob supported' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -464,7 +464,7 @@ test_expect_success 'R: feature cat-blob supported' '\n \t)\n '\n \n-test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n+test_expect_success 'cat-blob-fd must be a nonnegative integer' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -474,7 +474,7 @@ test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n \t)\n '\n \n-test_expect_success 'R: die on unknown option' '\n+test_expect_success 'die on unknown option' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -488,7 +488,7 @@ test_expect_success 'R: die on unknown option' '\n \t)\n '\n \n-test_expect_success 'R: unknown commandline options are rejected' '\\\n+test_expect_success 'unknown commandline options are rejected' '\\\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -498,7 +498,7 @@ test_expect_success 'R: unknown commandline options are rejected' '\\\n \t)\n '\n \n-test_expect_success 'R: feature-only names are rejected on the command line' '\n+test_expect_success 'feature-only names are rejected on the command line' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -511,7 +511,7 @@ test_expect_success 'R: feature-only names are rejected on the command line' '\n \t)\n '\n \n-test_expect_success 'R: die on invalid option argument' '\n+test_expect_success 'die on invalid option argument' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -525,7 +525,7 @@ test_expect_success 'R: die on invalid option argument' '\n \t)\n '\n \n-test_expect_success 'R: ignore non-git options' '\n+test_expect_success 'ignore non-git options' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -615,7 +615,7 @@ setup_marks_repo () {\n #\n # filemodify, three datarefs\n #\n-test_expect_success 'S: filemodify with garbage after mark must fail' '\n+test_expect_success 'filemodify with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -633,7 +633,7 @@ test_expect_success 'S: filemodify with garbage after mark must fail' '\n '\n \n # inline is misspelled; fast-import thinks it is some unknown dataref\n-test_expect_success 'S: filemodify with garbage after inline must fail' '\n+test_expect_success 'filemodify with garbage after inline must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -653,7 +653,7 @@ test_expect_success 'S: filemodify with garbage after inline must fail' '\n \t)\n '\n \n-test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n+test_expect_success 'filemodify with garbage after sha1 must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -674,7 +674,7 @@ test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n #\n # notemodify, three ways to say dataref\n #\n-test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n+test_expect_success 'notemodify with garbage after mark dataref must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -691,7 +691,7 @@ test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n \t)\n '\n \n-test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n+test_expect_success 'notemodify with garbage after inline dataref must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -711,7 +711,7 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail'\n \t)\n '\n \n-test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n+test_expect_success 'notemodify with garbage after sha1 dataref must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -732,7 +732,7 @@ test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n #\n # notemodify, mark in commit-ish\n #\n-test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n+test_expect_success 'notemodify with garbage after mark commit-ish must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -752,7 +752,7 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'\n #\n # from\n #\n-test_expect_success 'S: from with garbage after mark must fail' '\n+test_expect_success 'from with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -777,7 +777,7 @@ test_expect_success 'S: from with garbage after mark must fail' '\n #\n # merge\n #\n-test_expect_success 'S: merge with garbage after mark must fail' '\n+test_expect_success 'merge with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -811,7 +811,7 @@ test_expect_success 'S: merge with garbage after mark must fail' '\n #\n # tag, from markref\n #\n-test_expect_success 'S: tag with garbage after mark must fail' '\n+test_expect_success 'tag with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -831,7 +831,7 @@ test_expect_success 'S: tag with garbage after mark must fail' '\n #\n # cat-blob markref\n #\n-test_expect_success 'S: cat-blob with garbage after mark must fail' '\n+test_expect_success 'cat-blob with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -846,7 +846,7 @@ test_expect_success 'S: cat-blob with garbage after mark must fail' '\n #\n # ls markref\n #\n-test_expect_success 'S: ls with garbage after mark must fail' '\n+test_expect_success 'ls with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -858,7 +858,7 @@ test_expect_success 'S: ls with garbage after mark must fail' '\n \t)\n '\n \n-test_expect_success 'S: ls with garbage after sha1 must fail' '\n+test_expect_success 'ls with garbage after sha1 must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -893,7 +893,7 @@ test_expect_success 'S: ls with garbage after sha1 must fail' '\n #\n test_path_eol_success () {\n \tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths at EOL with $test must work\" '\n+\ttest_expect_success \"paths at EOL with $test must work\" '\n \t\ttest_when_finished \"git branch -D S-path-eol\" &&\n \n \t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF >out 2>err &&\n@@ -1002,7 +1002,7 @@ test_path_eol_success 'octal escapes'   '\"\\150\\151\\056\\143\"' 'hi.c'\n #\n test_path_space_success () {\n \tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths before space with $test must work\" '\n+\ttest_expect_success \"paths before space with $test must work\" '\n \t\ttest_when_finished \"git branch -D S-path-space\" &&\n \n \t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF 2>err &&\n@@ -1067,7 +1067,7 @@ test_path_space_success 'octal escapes'      '\"\\150\\151\\056\\143\"' 'hi.c'\n #\n test_path_fail () {\n \tlocal change=\"$1\" what=\"$2\" prefix=\"$3\" path=\"$4\" suffix=\"$5\" err_grep=\"$6\"\n-\ttest_expect_success \"S: $change with $what must fail\" '\n+\ttest_expect_success \"$change with $what must fail\" '\n \t\ttest_must_fail git fast-import <<-EOF 2>err &&\n \t\tblob\n \t\tmark :1\n@@ -1130,7 +1130,7 @@ test_path_eol_fail   'ls (in commit)' 'ls :2 '       path\n # When 'ls' has no <dataref>, the <path> must be quoted.\n test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n \n-test_expect_success 'E: rfc2822 date, --date-format=raw' '\n+test_expect_success 'rfc2822 date, --date-format=raw' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -1153,7 +1153,7 @@ test_expect_success 'E: rfc2822 date, --date-format=raw' '\n \t)\n '\n \n-test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n+test_expect_success 'rfc2822 date, --date-format=rfc2822' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\ndiff --git a/t/t9308-fast-import-stream.sh b/t/t9308-fast-import-stream.sh\nindex f8743cbfa4..cb361c0369 100755\n--- a/t/t9308-fast-import-stream.sh\n+++ b/t/t9308-fast-import-stream.sh\n@@ -26,7 +26,7 @@ test_expect_success 'truncated stream complains' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print old blob' '\n+test_expect_success !MINGW 'print old blob' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -44,7 +44,7 @@ test_expect_success !MINGW 'R: print old blob' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n+test_expect_success !MINGW 'in-stream cat-blob-fd not respected' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -71,7 +71,7 @@ test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print mark for new blob' '\n+test_expect_success !MINGW 'print mark for new blob' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -90,7 +90,7 @@ test_expect_success !MINGW 'R: print mark for new blob' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print new blob' '\n+test_expect_success !MINGW 'print new blob' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -114,7 +114,7 @@ test_expect_success !MINGW 'R: print new blob' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print new blob by sha1' '\n+test_expect_success !MINGW 'print new blob by sha1' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -149,7 +149,7 @@ setup_big_file () {\n \t)\n }\n \n-test_expect_success 'R: print two blobs to stdout' '\n+test_expect_success 'print two blobs to stdout' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -192,7 +192,7 @@ test_expect_success 'R: print two blobs to stdout' '\n \t)\n '\n \n-test_expect_success PIPE 'R: copy using cat-file' '\n+test_expect_success PIPE 'copy using cat-file' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -244,7 +244,7 @@ test_expect_success PIPE 'R: copy using cat-file' '\n \t)\n '\n \n-test_expect_success PIPE 'R: print blob mid-commit' '\n+test_expect_success PIPE 'print blob mid-commit' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -281,7 +281,7 @@ test_expect_success PIPE 'R: print blob mid-commit' '\n \t)\n '\n \n-test_expect_success PIPE 'R: print staged blob within commit' '\n+test_expect_success PIPE 'print staged blob within commit' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -322,7 +322,7 @@ test_expect_success PIPE 'R: print staged blob within commit' '\n \t)\n '\n \n-test_expect_success 'R: quiet option results in no stats being output' '\n+test_expect_success 'quiet option results in no stats being output' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -341,7 +341,7 @@ test_expect_success 'R: quiet option results in no stats being output' '\n \t)\n '\n \n-test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n+test_expect_success 'feature done means terminating \"done\" is mandatory' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -352,7 +352,7 @@ test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n \t)\n '\n \n-test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n+test_expect_success 'terminating \"done\" with trailing gibberish is ok' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -370,7 +370,7 @@ test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n \t)\n '\n \n-test_expect_success 'R: terminating \"done\" within commit' '\n+test_expect_success 'terminating \"done\" within commit' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -433,7 +433,7 @@ import_reference_commit () {\n \tINPUT_END\n }\n \n-test_expect_success 'O: comments are all skipped' '\n+test_expect_success 'comments are all skipped' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -485,7 +485,7 @@ test_expect_success 'O: comments are all skipped' '\n \t)\n '\n \n-test_expect_success 'O: blank lines not necessary after data commands' '\n+test_expect_success 'blank lines not necessary after data commands' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -523,7 +523,7 @@ test_expect_success 'O: blank lines not necessary after data commands' '\n \t)\n '\n \n-test_expect_success 'O: blank lines not necessary after other commands' '\n+test_expect_success 'blank lines not necessary after other commands' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -577,7 +577,7 @@ test_expect_success 'O: blank lines not necessary after other commands' '\n \t)\n '\n \n-test_expect_success 'O: progress outputs as requested by input' '\n+test_expect_success 'progress outputs as requested by input' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -616,7 +616,7 @@ test_expect_success 'O: progress outputs as requested by input' '\n ##\n ## R: very large blobs\n ##\n-test_expect_success 'R: blob bigger than threshold' '\n+test_expect_success 'blob bigger than threshold' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -671,7 +671,7 @@ w_input () {\n \tW_INPUT_END\n }\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with no newlines' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -681,7 +681,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines'\n \t)\n '\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with one newline' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -691,7 +691,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline'\n \t)\n '\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with ugly second newline' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -707,7 +707,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second n\n \t)\n '\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with erroneous third newline' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -718,7 +718,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous thi\n \t)\n '\n \n-test_expect_success ICONV 'X: handling encoding' '\n+test_expect_success ICONV 'handling encoding' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -740,7 +740,7 @@ test_expect_success ICONV 'X: handling encoding' '\n \t)\n '\n \n-test_expect_success 'X: replace ref that becomes useless is removed' '\n+test_expect_success 'replace ref that becomes useless is removed' '\n \ttest_when_finished \"rm -rf testrepo\" &&\n \tgit init -qb main testrepo &&\n \t(\n@@ -771,7 +771,7 @@ test_expect_success 'X: replace ref that becomes useless is removed' '\n \n for root in '\"\"' ''\n do\n-\ttest_expect_success \"T: ls root ($root) tree\" '\n+\ttest_expect_success \"ls root ($root) tree\" '\n \t\ttest_when_finished \"rm -rf repo\" &&\n \t\tgit init repo &&\n \t\t(\n@@ -790,7 +790,7 @@ do\n \t'\n done\n \n-test_expect_success 'I: export-pack-edges' '\n+test_expect_success 'export-pack-edges' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init -b main repo &&\n \t(\ndiff --git a/t/t9309-fast-import-checkpoint.sh b/t/t9309-fast-import-checkpoint.sh\nindex 64674dcf83..5c1e80c240 100755\n--- a/t/t9309-fast-import-checkpoint.sh\n+++ b/t/t9309-fast-import-checkpoint.sh\n@@ -91,7 +91,7 @@ setup_checkpoint_repo () {\n \tINPUT_END\n }\n \n-test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n+test_expect_success PIPE 'checkpoint helper does not get stuck with extra output' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-INPUT_END &&\n \tprogress foo\n@@ -103,7 +103,7 @@ test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra out\n \tbackground_import_still_running\n '\n \n-test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n+test_expect_success PIPE 'checkpoint updates refs after reset' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-\\INPUT_END &&\n \treset refs/heads/V\n@@ -116,7 +116,7 @@ test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n \tbackground_import_still_running\n '\n \n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n+test_expect_success PIPE 'checkpoint updates refs and marks after commit' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/V\n@@ -140,7 +140,7 @@ test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n \n # Re-create the exact same commit, but on a different branch: no new object is\n # created in the database, but the refs and marks still need to be updated.\n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n+test_expect_success PIPE 'checkpoint updates refs and marks after commit (no new objects)' '\n \tsetup_checkpoint_repo &&\n \tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n \tcommit refs/heads/V\n@@ -170,7 +170,7 @@ test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no\n \tbackground_import_still_running\n '\n \n-test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n+test_expect_success PIPE 'checkpoint updates tags after tag' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-INPUT_END &&\n \ttag Vtag\ndiff --git a/t/t9310-fast-import-submodule.sh b/t/t9310-fast-import-submodule.sh\nindex 6e7dbda9f9..1d33ec7055 100755\n--- a/t/t9310-fast-import-submodule.sh\n+++ b/t/t9310-fast-import-submodule.sh\n@@ -72,7 +72,7 @@ setup_gitlinks_repo () {\n \t)\n }\n \n-test_expect_success 'P: superproject & submodule mix' '\n+test_expect_success 'superproject & submodule mix' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -91,7 +91,7 @@ test_expect_success 'P: superproject & submodule mix' '\n \t)\n '\n \n-test_expect_success 'P: verbatim SHA gitlinks' '\n+test_expect_success 'verbatim SHA gitlinks' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -134,7 +134,7 @@ test_expect_success 'P: verbatim SHA gitlinks' '\n \t)\n '\n \n-test_expect_success 'P: fail on inline gitlink' '\n+test_expect_success 'fail on inline gitlink' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -161,7 +161,7 @@ test_expect_success 'P: fail on inline gitlink' '\n \t)\n '\n \n-test_expect_success 'P: fail on blob mark in gitlink' '\n+test_expect_success 'fail on blob mark in gitlink' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -277,7 +277,7 @@ cat >Y-marks <<\\Y_INPUT_END\n :4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n Y_INPUT_END\n \n-test_expect_success 'Y: rewrite submodules' '\n+test_expect_success 'rewrite submodules' '\n \ttest_when_finished \"rm -rf main1\" &&\n \ttest_oid_cache <<-EOF &&\n \tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n@@ -294,7 +294,7 @@ test_expect_success 'Y: rewrite submodules' '\n \t)\n '\n \n-test_expect_success 'Y: reference pending tag or commit' '\n+test_expect_success 'reference pending tag or commit' '\n \ttest_oid_cache <<-EOF &&\n \tpending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04\n \tpending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d\ndiff --git a/t/t9311-fast-import-refs.sh b/t/t9311-fast-import-refs.sh\nindex 2bb8ac1d46..3283fe77c0 100755\n--- a/t/t9311-fast-import-refs.sh\n+++ b/t/t9311-fast-import-refs.sh\n@@ -13,7 +13,7 @@ setup_two_commit_repo () {\n \ttest_commit -C repo two\n }\n \n-test_expect_success 'F: non-fast-forward update skips' '\n+test_expect_success 'non-fast-forward update skips' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -55,7 +55,7 @@ test_expect_success 'F: non-fast-forward update skips' '\n \t)\n '\n \n-test_expect_success 'G: non-fast-forward update forced' '\n+test_expect_success 'non-fast-forward update forced' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -83,7 +83,7 @@ test_expect_success 'G: non-fast-forward update forced' '\n \t)\n '\n \n-test_expect_success 'J: reset existing branch creates empty commit' '\n+test_expect_success 'reset existing branch creates empty commit' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -112,7 +112,7 @@ test_expect_success 'J: reset existing branch creates empty commit' '\n \t)\n '\n \n-test_expect_success 'J: tag must fail on empty branch' '\n+test_expect_success 'tag must fail on empty branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -130,7 +130,7 @@ test_expect_success 'J: tag must fail on empty branch' '\n \t)\n '\n \n-test_expect_success 'K: reinit branch with from' '\n+test_expect_success 'reinit branch with from' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -159,7 +159,7 @@ test_expect_success 'K: reinit branch with from' '\n \t)\n '\n \n-test_expect_success 'T: delete branch' '\n+test_expect_success 'delete branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -175,7 +175,7 @@ test_expect_success 'T: delete branch' '\n \t)\n '\n \n-test_expect_success 'T: empty reset doesnt delete branch' '\n+test_expect_success 'empty reset doesnt delete branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n\n-- \n2.56.GIT\n\n\n"},{"id":"558107","messageId":"xmqqik24tz2x.fsf@gitster.g","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"Re: [PATCH 00/20] t9300: group and move tests to other files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-11-10T16:45:26Z","receivedAt":"2026-11-10T16:45:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> While reading the git-fast-import(1) code, I stumbled upon t9300. The\n> test file is around 4000 LoC and each test has some dependency on the\n> state setup by previous tests.\n>\n> This long series unwinds some of these tests and moves them into\n> new/existing tests based on what they exercise. This leaves t9300 in a\n> better state. I think we can do more here, but I decided to stop before\n> this series got even longer. Based on the reception of this series, I\n> will follow up with more cleanups.\n\nWow, cleaning up this script is long overdue.  Thanks for tackling it.\n\n"},{"id":"558138","messageId":"xmqqfqx8qwmv.fsf@gitster.g","threadId":"66819","inReplyTo":"xmqqik24tz2x.fsf@gitster.g","subject":"Re: [PATCH 00/20] t9300: group and move tests to other files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-11-10T20:06:32Z","receivedAt":"2026-11-10T20:06:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Karthik Nayak <karthik.188@gmail.com> writes:\n>\n>> While reading the git-fast-import(1) code, I stumbled upon t9300. The\n>> test file is around 4000 LoC and each test has some dependency on the\n>> state setup by previous tests.\n>>\n>> This long series unwinds some of these tests and moves them into\n>> new/existing tests based on what they exercise. This leaves t9300 in a\n>> better state. I think we can do more here, but I decided to stop before\n>> this series got even longer. Based on the reception of this series, I\n>> will follow up with more cleanups.\n>\n> Wow, cleaning up this script is long overdue.  Thanks for tackling it.\n\nHaving said that, there are a few topics in flight that touch this\nage-old script and they are already in 'next'.\n\n(cc/early-scan-options)\nc2b4099f84 fast-import: use early_scan_options() for --allow-unsafe-features\ncc4affc5ee parse-options: add early_scan_options()\nf7fd8656e9 parse-options: extract lookup_long_opt() from parse_long_opt()\n6aa1fb2271 parse-options: add parse_options_takes_argument()\n\n(tj/drop-no-parseopt)\n1db50e0e62 t0012: catch builtins that keep NO_PARSEOPT after conversion\n5d735e50ef git.c: drop NO_PARSEOPT from builtins that use parse-options\nee68c316a7 parse-options: answer --git-completion-helper before command runs\n\nSo you may want to rebase this clean-up on a synthetic base, starting\nat 1891de46f7 (Sync with Git 2.56.1, 2026-11-09) and merging these\ntwo topics on top.\n\nThanks.\n\n"},{"id":"558182","messageId":"CAOLa=ZRHo810k6dJjYsf2ahkVAidEeXNtXjTXUVyApmFLhus7w@mail.gmail.com","threadId":"66819","inReplyTo":"xmqqfqx8qwmv.fsf@gitster.g","subject":"Re: [PATCH 00/20] t9300: group and move tests to other files","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-11T11:22:59Z","receivedAt":"2026-11-11T11:22:59Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Karthik Nayak <karthik.188@gmail.com> writes:\n>>\n>>> While reading the git-fast-import(1) code, I stumbled upon t9300. The\n>>> test file is around 4000 LoC and each test has some dependency on the\n>>> state setup by previous tests.\n>>>\n>>> This long series unwinds some of these tests and moves them into\n>>> new/existing tests based on what they exercise. This leaves t9300 in a\n>>> better state. I think we can do more here, but I decided to stop before\n>>> this series got even longer. Based on the reception of this series, I\n>>> will follow up with more cleanups.\n>>\n>> Wow, cleaning up this script is long overdue.  Thanks for tackling it.\n>\n> Having said that, there are a few topics in flight that touch this\n> age-old script and they are already in 'next'.\n>\n> (cc/early-scan-options)\n> c2b4099f84 fast-import: use early_scan_options() for --allow-unsafe-features\n> cc4affc5ee parse-options: add early_scan_options()\n> f7fd8656e9 parse-options: extract lookup_long_opt() from parse_long_opt()\n> 6aa1fb2271 parse-options: add parse_options_takes_argument()\n>\n> (tj/drop-no-parseopt)\n> 1db50e0e62 t0012: catch builtins that keep NO_PARSEOPT after conversion\n> 5d735e50ef git.c: drop NO_PARSEOPT from builtins that use parse-options\n> ee68c316a7 parse-options: answer --git-completion-helper before command runs\n>\n> So you may want to rebase this clean-up on a synthetic base, starting\n> at 1891de46f7 (Sync with Git 2.56.1, 2026-11-09) and merging these\n> two topics on top.\n>\n> Thanks.\n\nAh, that's something I missed checking. I will rebase and check for\nconflicts. Will give it a day or two, since reviews can still happen on\nthis version.\n\nThanks,\nKarthik\n"},{"id":"558303","messageId":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com","subject":"[PATCH v2 00/20] t9300: group and move tests to other files","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:00Z","receivedAt":"2026-11-12T17:34:00Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"While reading the git-fast-import(1) code, I stumbled upon t9300. The\ntest file is around 4000 LoC and each test has some dependency on the\nstate setup by previous tests.\n\nThis long series unwinds some of these tests and moves them into\nnew/existing tests based on what they exercise. This leaves t9300 in a\nbetter state. I think we can do more here, but I decided to stop before\nthis series got even longer. Based on the reception of this series, I\nwill follow up with more cleanups.\n\nAlso, we could squash some of the commits together. But I found them\neasier to read through this way.\n\n---\nChanges in v2:\n- Rebased on top master: 1891de46f7 (Sync with Git 2.56.1, 2026-11-09)\n- Merged in and resolved conflicts from the topics in next:\n  - cc/early-scan-options\n  - tj/drop-no-parseopt\n- Did some small cleanups\n- Link to v1: https://patch.msgid.link/20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com\n\n---\nKarthik Nayak (20):\n      t9300: move 'fastimport.unpackLimit' to the required test\n      t9300: make the series B tests self-contained\n      t9300: make the series T tests self-contained\n      t9300: make the series S tests self-contained\n      t9300: make the series V tests self-contained\n      t9300: make the series Q tests self-contained\n      t9300: make the series P tests self-contained\n      t9300: make the series O tests self-contained\n      t9300: make the big blob tests self-contained\n      t9300: make the ref update tests self-contained\n      t9300: make the date format tests self-contained\n      t9300: make the pack edges test self-contained\n      t9300: make the marks tests self-contained\n      t9300: make the series Y tests self-contained\n      t9300: make the cat-blob tests self-contained\n      t9300: make the feature and option tests self-contained\n      t9300: make the stream tests self-contained\n      t9300: make the get-mark and encoding tests self-contained\n      t9300: move self-contained tests into dedicated files\n      t93xx: drop the series letter from the moved test names\n\n t/meson.build                     |    5 +\n t/t9300-fast-import.sh            | 2884 +------------------------------------\n t/t9301-fast-import-notes.sh      |  400 +++++\n t/t9304-fast-import-marks.sh      |  393 +++++\n t/t9307-fast-import-validation.sh | 1262 ++++++++++++++++\n t/t9308-fast-import-stream.sh     |  890 ++++++++++++\n t/t9309-fast-import-checkpoint.sh |  188 +++\n t/t9310-fast-import-submodule.sh  |  385 +++++\n t/t9311-fast-import-refs.sh       |  194 +++\n 9 files changed, 3718 insertions(+), 2883 deletions(-)\n\nRange-diff versus v1:\n\n 1:  45b5b440f4 =  1:  e3f2bfcc69 t9300: move 'fastimport.unpackLimit' to the required test\n 2:  130034d57d =  2:  649260b54d t9300: make the series B tests self-contained\n 3:  9fe75bdaf2 =  3:  7b134f184d t9300: make the series T tests self-contained\n 4:  a9c1bd2483 !  4:  b401701e1e t9300: make the series S tests self-contained\n    @@ Commit message\n         Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n     \n      ## t/t9300-fast-import.sh ##\n    -@@ t/t9300-fast-import.sh: test_expect_success 'R: blob appears only once' '\n    +@@ t/t9300-fast-import.sh: test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n      #\n      #   invalid dataref ..\n      #\n 5:  a8b7bf3aa4 =  5:  18ffcfcfd9 t9300: make the series V tests self-contained\n 6:  73f94d5790 !  6:  b81ec42557 t9300: make the series Q tests self-contained\n    @@ Commit message\n         commit notes', and use shell variables set by the preceding tests.\n         Replace 'Q: commit notes' with a 'setup_notes_repo()' function, which\n         creates a new repository, runs the import and sets those variables, so\n    -    each test can invoke it. Run the import with 'fastimport.unpackLimit'\n    -    set to 0, so that a pack is written for 'Q: verify pack' to check.\n    +    each test can invoke it.\n     \n    -    Also stop using the 'verify_packs()' function, to make it easier to move\n    -    these tests to another file.\n    +    Drop 'Q: verify pack', as other tests already verify the packs written\n    +    by fast-import.\n     \n         Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n     \n    @@ t/t9300-fast-import.sh: test_expect_success 'Q: commit notes' '\n     -\tgit fast-import <input &&\n     -\tgit log --raw notes-test\n     -'\n    -+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <repo/input &&\n    +-\n    +-test_expect_success 'Q: verify pack' '\n    +-\tverify_packs\n    +-'\n    ++\tgit -C repo fast-import <repo/input &&\n     +\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n     +\tcommit2=$(git -C repo rev-parse notes-test^) &&\n     +\tcommit3=$(git -C repo rev-parse notes-test)\n     +}\n      \n    - test_expect_success 'Q: verify pack' '\n    --\tverify_packs\n    -+\tsetup_notes_repo &&\n    -+\t(\n    -+\t\tcd repo &&\n    -+\t\tfor p in .git/objects/pack/*.pack\n    -+\t\tdo\n    -+\t\t\tgit verify-pack \"$p\" || return 1\n    -+\t\tdone\n    -+\t)\n    - '\n    - \n      test_expect_success 'Q: verify first commit' '\n     -\tcommit1=$(git rev-parse notes-test~2) &&\n     -\tcommit2=$(git rev-parse notes-test^) &&\n 7:  65951bf97e =  7:  4265ae48a9 t9300: make the series P tests self-contained\n 8:  8c277ecdfe =  8:  19b4d8b559 t9300: make the series O tests self-contained\n 9:  2e1f122a03 !  9:  3af6c83f5c t9300: make the big blob tests self-contained\n    @@ t/t9300-fast-import.sh: test_expect_success 'R: corrupt lines do not mess marks\n     -\ttest 1 = $n\n     -'\n     -\n    - ###\n    - ### series S (mark and path parsing)\n    - ###\n    + test_expect_success 'R: --git-completion-helper does not read from stdin' '\n    + \tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    + \techo garbage | git fast-import --git-completion-helper >out &&\n10:  178e01d022 ! 10:  6104474191 t9300: make the ref update tests self-contained\n    @@ Commit message\n         series 'F', 'G', 'J' and 'K' to make them independent of state from\n         previous tests. Add a 'setup_two_commit_repo()' function which creates\n         a repository with two commits on 'main', so each test can invoke it.\n    -    The tests used to build on the 'branch' branch of earlier tests.\n     \n         Fold the tests which only check the result of an import into the tests\n         performing it, as they can't run on their own. As\n    @@ t/t9300-fast-import.sh: test_expect_success 'F: verify other commit' '\n      '\n      \n      ###\n    -@@ t/t9300-fast-import.sh: test_expect_success 'I: verify edge list' '\n    +@@ t/t9300-fast-import.sh: test_expect_success 'I: export-pack-edges via stdin' '\n      ###\n      \n      test_expect_success 'J: reset existing branch creates empty commit' '\n11:  d94431d13c = 11:  6c1b12057c t9300: make the date format tests self-contained\n12:  44d3602cbc ! 12:  5d1e8cada1 t9300: make the pack edges test self-contained\n    @@ Commit message\n         Similar to the previous commits, modify the pack-edges tests to make\n         them independent of state from previous tests.\n     \n    -    Fold 'I: verify edge list' into the test creating the edge list, as it\n    -    can't run on its own. Pack edges are only recorded for packs which are\n    -    kept, so set 'fastimport.unpackLimit' to 0 for the import.\n    +    Pack edges are only recorded for packs which are kept, so set\n    +    'fastimport.unpackLimit' to 0 for the import.\n     \n         Create the repository with 'git init -b main', as the import builds on\n         'main' and t9302, where this test ends up, doesn't set\n    @@ t/t9300-fast-import.sh\n     @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' '\n      ###\n      \n    + test_expect_success 'I: export-pack-edges option forbidden by default' '\n    +-\techo \"option git export-pack-edges=edges.list\" >input &&\n    +-\ttest_must_fail git fast-import <input 2>err &&\n    +-\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\t\techo \"option git export-pack-edges=edges.list\" >input &&\n    ++\t\ttest_must_fail git fast-import <input 2>err &&\n    ++\t\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    + '\n    + \n      test_expect_success 'I: export-pack-edges' '\n    +-\ttest_when_finished \"rm edges.list\" &&\n     -\tcat >input <<-INPUT_END &&\n     -\tcommit refs/heads/export-boundary\n     -\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n    @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' '\n     +\t\tCOMMIT\n      \n     -\tINPUT_END\n    --\tgit fast-import --export-pack-edges=edges.list <input\n    --'\n    -+\t\tfrom refs/heads/main\n    - \n    --test_expect_success 'I: verify edge list' '\n    +-\tgit fast-import --export-pack-edges=edges.list <input &&\n     -\tcat >expect <<-EOF &&\n     -\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n     -\tEOF\n     -\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n     -\ttest_cmp expect actual\n    ++\t\tfrom refs/heads/main\n    ++\n     +\t\tINPUT_END\n     +\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n     +\t\t\t--export-pack-edges=edges.list <input &&\n    @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' '\n     +\t)\n      '\n      \n    + test_expect_success 'I: export-pack-edges via stdin' '\n    +-\ttest_when_finished \"rm edges.list\" &&\n    +-\tcat >input <<-INPUT_END &&\n    +-\toption git export-pack-edges=edges.list\n    +-\tcommit refs/heads/export-boundary-2\n    +-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n    +-\tdata <<COMMIT\n    +-\tone more similar commit\n    +-\tCOMMIT\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init -b main repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\t\ttest_commit one &&\n    + \n    +-\tfrom refs/heads/branch\n    ++\t\tcat >input <<-INPUT_END &&\n    ++\t\toption git export-pack-edges=edges.list\n    ++\t\tcommit refs/heads/export-boundary\n    ++\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n    ++\t\tdata <<COMMIT\n    ++\t\tone more similar commit\n    ++\t\tCOMMIT\n    + \n    +-\tINPUT_END\n    +-\tgit fast-import --allow-unsafe-features <input &&\n    +-\tcat >expect <<-EOF &&\n    +-\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary-2)\n    +-\tEOF\n    +-\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n    +-\ttest_cmp expect actual\n    ++\t\tfrom refs/heads/main\n    ++\n    ++\t\tINPUT_END\n    ++\n    ++\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n    ++\t\t\t--allow-unsafe-features <input &&\n    ++\t\tcat >expect <<-EOF &&\n    ++\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n    ++\t\tEOF\n    ++\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n    ++\t\ttest_cmp expect actual\n    ++\t)\n    + '\n    + \n      ###\n13:  54f456a8b3 ! 13:  80552f9997 t9300: make the marks tests self-contained\n    @@ t/t9300-fast-import.sh: test_expect_success 'R: export-marks feature forbidden b\n     +\t)\n      '\n      \n    + test_expect_success 'R: --allow-unsafe-features found after a value' '\n    +@@ t/t9300-fast-import.sh: test_expect_success 'R: --allow-unsafe-features after a non-option' '\n    + '\n    + \n      test_expect_success 'R: catch typo in marks file name' '\n     -\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n     -\techo \"feature import-marks=nonexistent.marks\" |\n14:  19b51b871b <  -:  ---------- t9300: make the series Y tests self-contained\n -:  ---------- > 14:  7d3e0b60f1 t9300: make the series Y tests self-contained\n15:  dd62943ca0 ! 15:  935ae34fbf t9300: make the cat-blob tests self-contained\n    @@ Metadata\n      ## Commit message ##\n         t9300: make the cat-blob tests self-contained\n     \n    -    The 'R: print' tests and 'R: copy using cat-file' write blobs into the\n    -    repository of the trash directory, which all other tests share. 'R:\n    -    print two blobs to stdout' and 'R: copy using cat-file' also read the\n    -    'big' file written by the preceding 'setup: big file' test, so they\n    -    can't run on their own.\n    -\n    -    Run each of these tests in a new repository. Convert the setup test to a\n    -    'setup_big_file()' function, which writes the file in the repository of\n    -    the calling test, and invoke it from both tests.\n    +    Similar to the previous commits, modify the cat-blog tests to make\n    +    them independent of state from previous tests.\n     \n         Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n     \n16:  25609c8979 ! 16:  405057430f t9300: make the feature and option tests self-contained\n    @@ t/t9300-fast-import.sh: test_expect_success 'Q: deny note on empty branch' '\n      '\n      \n      test_expect_success 'R: export-marks feature results in a marks file being created' '\n    +@@ t/t9300-fast-import.sh: test_expect_success 'R: export-marks options can be overridden by commandline op\n    + '\n    + \n    + test_expect_success 'R: --allow-unsafe-features found after a value' '\n    +-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\tgit fast-import --allow-unsafe-features <input &&\n    +-\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n    +-\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n    +-\tgit fast-import --date-format raw --allow-unsafe-features <input\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\tgit fast-import --allow-unsafe-features <input &&\n    ++\t\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n    ++\t\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n    ++\t\tgit fast-import --date-format raw --allow-unsafe-features <input\n    ++\t)\n    + '\n    + \n    + test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n    +-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    +-\tgit fast-import --allow-unsafe <input\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    ++\t\tgit fast-import --allow-unsafe <input\n    ++\t)\n    + '\n    + \n    + test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n    +-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n    +-\t\tgit fast-import --allow-unsafe <input 2>err &&\n    +-\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n    ++\t\t\tgit fast-import --allow-unsafe <input 2>err &&\n    ++\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    + '\n    + \n    + test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n    +-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    +-\t\tgit fast-import --quiet --export-pack \\\n    +-\t\t--allow-unsafe-features <input 2>err &&\n    +-\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    ++\t\t\tgit fast-import --quiet --export-pack \\\n    ++\t\t\t--allow-unsafe-features <input 2>err &&\n    ++\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    + '\n    + \n    + test_expect_success 'R: --allow-unsafe-features after a non-option' '\n    +-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\ttest_must_fail git fast-import --depth 5 extra \\\n    +-\t\t--allow-unsafe-features <input 2>err &&\n    +-\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\ttest_must_fail git fast-import --depth 5 extra \\\n    ++\t\t\t--allow-unsafe-features <input 2>err &&\n    ++\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    + '\n    + \n    + test_expect_success 'R: catch typo in marks file name' '\n     @@ t/t9300-fast-import.sh: test_expect_success 'R: feature no-relative-marks should be honoured' '\n      \n      \n17:  7573e1381d ! 17:  bafacc9dd4 t9300: make the stream tests self-contained\n    @@ t/t9300-fast-import.sh: test_expect_success PIPE 'R: print staged blob within co\n      '\n      \n      test_expect_success 'R: die on unknown option' '\n    +@@ t/t9300-fast-import.sh: test_expect_success 'R: blob bigger than threshold' '\n    + '\n    + \n    + test_expect_success 'R: --git-completion-helper does not read from stdin' '\n    +-\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    +-\techo garbage | git fast-import --git-completion-helper >out &&\n    +-\ttest_grep -e \"--date-format=\" out &&\n    +-\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    +-\ttest_cmp before after\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    ++\t\techo garbage | git fast-import --git-completion-helper >out &&\n    ++\t\ttest_grep -e \"--date-format=\" out &&\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    ++\t\ttest_cmp before after\n    ++\t)\n    + '\n    + \n    + test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n    +-\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    +-\techo garbage | git fast-import --git-completion-helper-all >all &&\n    +-\ttest_grep -e \"--allow-unsafe-features\" all &&\n    +-\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    +-\ttest_cmp before after\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    ++\t\techo garbage | git fast-import --git-completion-helper-all >all &&\n    ++\t\ttest_grep -e \"--allow-unsafe-features\" all &&\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    ++\t\ttest_cmp before after\n    ++\t)\n    + '\n    + \n    + ###\n18:  fb94ca9bc4 = 18:  100ad72f13 t9300: make the get-mark and encoding tests self-contained\n19:  29df1daba9 ! 19:  f3c7d85bd9 t9300: move self-contained tests into dedicated files\n    @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' '\n     -### series I\n     -###\n     -\n    +-test_expect_success 'I: export-pack-edges option forbidden by default' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\t\techo \"option git export-pack-edges=edges.list\" >input &&\n    +-\t\ttest_must_fail git fast-import <input 2>err &&\n    +-\t\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n    +-\t)\n    +-'\n    +-\n     -test_expect_success 'I: export-pack-edges' '\n     -\ttest_when_finished \"rm -rf repo\" &&\n     -\tgit init -b main repo &&\n    @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' '\n     -\t)\n     -'\n     -\n    +-test_expect_success 'I: export-pack-edges via stdin' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init -b main repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\t\ttest_commit one &&\n    +-\n    +-\t\tcat >input <<-INPUT_END &&\n    +-\t\toption git export-pack-edges=edges.list\n    +-\t\tcommit refs/heads/export-boundary\n    +-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n    +-\t\tdata <<COMMIT\n    +-\t\tone more similar commit\n    +-\t\tCOMMIT\n    +-\n    +-\t\tfrom refs/heads/main\n    +-\n    +-\t\tINPUT_END\n    +-\n    +-\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n    +-\t\t\t--allow-unsafe-features <input &&\n    +-\t\tcat >expect <<-EOF &&\n    +-\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n    +-\t\tEOF\n    +-\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n    +-\t\ttest_cmp expect actual\n    +-\t)\n    +-'\n    +-\n     -###\n     -### series J\n     -###\n    @@ t/t9300-fast-import.sh: do\n     -###\n     -### series O\n     -###\n    --\n    + \n     -setup_import_repo () {\n     -\ttest_when_finished \"rm -rf repo\" &&\n     -\tgit init repo &&\n    @@ t/t9300-fast-import.sh: do\n     -\n     -\tINPUT_END\n     -\n    --\tgit -C repo -c fastimport.unpackLimit=0 fast-import <repo/input &&\n    +-\tgit -C repo fast-import <repo/input &&\n     -\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n     -\tcommit2=$(git -C repo rev-parse notes-test^) &&\n     -\tcommit3=$(git -C repo rev-parse notes-test)\n     -}\n     -\n    --test_expect_success 'Q: verify pack' '\n    --\tsetup_notes_repo &&\n    --\t(\n    --\t\tcd repo &&\n    --\t\tfor p in .git/objects/pack/*.pack\n    --\t\tdo\n    --\t\t\tgit verify-pack \"$p\" || return 1\n    --\t\tdone\n    --\t)\n    --'\n    --\n     -test_expect_success 'Q: verify first commit' '\n     -\tsetup_notes_repo &&\n     -\t(\n    @@ t/t9300-fast-import.sh: do\n     -\t)\n     -'\n     -\n    +-test_expect_success 'R: --allow-unsafe-features found after a value' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\n    +-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\t\tgit fast-import --allow-unsafe-features <input &&\n    +-\t\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n    +-\t\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n    +-\t\tgit fast-import --date-format raw --allow-unsafe-features <input\n    +-\t)\n    +-'\n    +-\n    +-test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\n    +-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\t\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    +-\t\tgit fast-import --allow-unsafe <input\n    +-\t)\n    +-'\n    +-\n    +-test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\n    +-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n    +-\t\t\tgit fast-import --allow-unsafe <input 2>err &&\n    +-\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    +-\t)\n    +-'\n    +-\n    +-test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\n    +-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    +-\t\t\tgit fast-import --quiet --export-pack \\\n    +-\t\t\t--allow-unsafe-features <input 2>err &&\n    +-\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    +-\t)\n    +-'\n    +-\n    +-test_expect_success 'R: --allow-unsafe-features after a non-option' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\n    +-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    +-\t\ttest_must_fail git fast-import --depth 5 extra \\\n    +-\t\t\t--allow-unsafe-features <input 2>err &&\n    +-\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    +-\t)\n    +-'\n    +-\n     -test_expect_success 'R: catch typo in marks file name' '\n     -\ttest_when_finished \"rm -rf repo\" &&\n     -\tgit init repo &&\n    @@ t/t9300-fast-import.sh: do\n     -\t)\n     -'\n     -\n    +-test_expect_success 'R: --git-completion-helper does not read from stdin' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\n    +-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    +-\t\techo garbage | git fast-import --git-completion-helper >out &&\n    +-\t\ttest_grep -e \"--date-format=\" out &&\n    +-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    +-\t\ttest_cmp before after\n    +-\t)\n    +-'\n    +-\n    +-test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\n    +-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    +-\t\techo garbage | git fast-import --git-completion-helper-all >all &&\n    +-\t\ttest_grep -e \"--allow-unsafe-features\" all &&\n    +-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    +-\t\ttest_cmp before after\n    +-\t)\n    +-'\n    +-\n     -###\n     -### series S (mark and path parsing)\n     -###\n    @@ t/t9300-fast-import.sh: do\n     -\t\tgit rev-parse --verify refs/heads/not-to-delete\n     -\t)\n     -'\n    --\n    + \n      ###\n      ### series U (filedelete)\n    - ###\n     @@ t/t9300-fast-import.sh: do\n      \t'\n      done\n    @@ t/t9300-fast-import.sh: do\n     -:4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n     -Y_INPUT_END\n     -\n    +-test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" >input &&\n    +-\t\ttest_must_fail git fast-import <input 2>err &&\n    +-\t\ttest_grep \"feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features\" err\n    +-\t)\n    +-'\n    +-\n    +-test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n    +-\ttest_when_finished \"rm -rf repo\" &&\n    +-\tgit init repo &&\n    +-\t(\n    +-\t\tcd repo &&\n    +-\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" >input &&\n    +-\t\ttest_must_fail git fast-import <input 2>err &&\n    +-\t\ttest_grep \"feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features\" err\n    +-\t)\n    +-'\n    +-\n     -test_expect_success 'Y: rewrite submodules' '\n     -\ttest_when_finished \"rm -rf main1\" &&\n     -\ttest_oid_cache <<-EOF &&\n     -\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n     -\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n     -\tEOF\n    +-\n     -\tgit init main1 &&\n     -\t(\n     -\t\tcd main1 &&\n    @@ t/t9300-fast-import.sh: do\n     -\t\tEOF\n     -\t)\n     -'\n    +-\n    +-test_expect_success 'Y: rewrite submodules via stdin' '\n    +-\ttest_when_finished \"rm -rf main1\" &&\n    +-\ttest_oid_cache <<-EOF &&\n    +-\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n    +-\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n    +-\tEOF\n    +-\n    +-\tgit init main1 &&\n    +-\t(\n    +-\t\tcd main1 &&\n    +-\t\tgit init sub2 &&\n    +-\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n    +-\t\t{\n    +-\t\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" &&\n    +-\t\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" &&\n    +-\t\t\tcat ../Y-main-input\n    +-\t\t} | git fast-import --allow-unsafe-features &&\n    +-\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n    +-\t)\n    +-'\n     -\n      test_done\n     \n    @@ t/t9301-fast-import-notes.sh: test_expect_success \"add notes to $num_commits com\n     +\n     +\tINPUT_END\n     +\n    -+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <repo/input &&\n    ++\tgit -C repo fast-import <repo/input &&\n     +\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n     +\tcommit2=$(git -C repo rev-parse notes-test^) &&\n     +\tcommit3=$(git -C repo rev-parse notes-test)\n     +}\n     +\n    -+test_expect_success 'Q: verify pack' '\n    -+\tsetup_notes_repo &&\n    -+\t(\n    -+\t\tcd repo &&\n    -+\t\tfor p in .git/objects/pack/*.pack\n    -+\t\tdo\n    -+\t\t\tgit verify-pack \"$p\" || return 1\n    -+\t\tdone\n    -+\t)\n    -+'\n    -+\n     +test_expect_success 'Q: verify first commit' '\n     +\tsetup_notes_repo &&\n     +\t(\n    @@ t/t9307-fast-import-validation.sh (new)\n     +\t)\n     +'\n     +\n    ++###\n    ++### series S (mark and path parsing)\n    ++###\n     +#\n     +# Make sure missing spaces and EOLs after mark references\n     +# cause errors.\n    @@ t/t9307-fast-import-validation.sh (new)\n     +\t)\n     +'\n     +\n    ++test_expect_success 'R: --allow-unsafe-features found after a value' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\tgit fast-import --allow-unsafe-features <input &&\n    ++\t\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n    ++\t\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n    ++\t\tgit fast-import --date-format raw --allow-unsafe-features <input\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    ++\t\tgit fast-import --allow-unsafe <input\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n    ++\t\t\tgit fast-import --allow-unsafe <input 2>err &&\n    ++\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n    ++\t\t\tgit fast-import --quiet --export-pack \\\n    ++\t\t\t--allow-unsafe-features <input 2>err &&\n    ++\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'R: --allow-unsafe-features after a non-option' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n    ++\t\ttest_must_fail git fast-import --depth 5 extra \\\n    ++\t\t\t--allow-unsafe-features <input 2>err &&\n    ++\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    ++'\n    ++\n     +test_done\n     \n      ## t/t9308-fast-import-stream.sh (new) ##\n    @@ t/t9308-fast-import-stream.sh (new)\n     +\t)\n     +'\n     +\n    ++test_expect_success 'I: export-pack-edges option forbidden by default' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\t\techo \"option git export-pack-edges=edges.list\" >input &&\n    ++\t\ttest_must_fail git fast-import <input 2>err &&\n    ++\t\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'I: export-pack-edges via stdin' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init -b main repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\t\ttest_commit one &&\n    ++\n    ++\t\tcat >input <<-INPUT_END &&\n    ++\t\toption git export-pack-edges=edges.list\n    ++\t\tcommit refs/heads/export-boundary\n    ++\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n    ++\t\tdata <<COMMIT\n    ++\t\tone more similar commit\n    ++\t\tCOMMIT\n    ++\n    ++\t\tfrom refs/heads/main\n    ++\n    ++\t\tINPUT_END\n    ++\n    ++\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n    ++\t\t\t--allow-unsafe-features <input &&\n    ++\t\tcat >expect <<-EOF &&\n    ++\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n    ++\t\tEOF\n    ++\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n    ++\t\ttest_cmp expect actual\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'R: --git-completion-helper does not read from stdin' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    ++\t\techo garbage | git fast-import --git-completion-helper >out &&\n    ++\t\ttest_grep -e \"--date-format=\" out &&\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    ++\t\ttest_cmp before after\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n    ++\t\techo garbage | git fast-import --git-completion-helper-all >all &&\n    ++\t\ttest_grep -e \"--allow-unsafe-features\" all &&\n    ++\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n    ++\t\ttest_cmp before after\n    ++\t)\n    ++'\n    ++\n     +test_done\n     \n      ## t/t9309-fast-import-checkpoint.sh (new) ##\n    @@ t/t9310-fast-import-submodule.sh (new)\n     +\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n     +\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n     +\tEOF\n    ++\n     +\tgit init main1 &&\n     +\t(\n     +\t\tcd main1 &&\n    @@ t/t9310-fast-import-submodule.sh (new)\n     +\t)\n     +'\n     +\n    ++test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" >input &&\n    ++\t\ttest_must_fail git fast-import <input 2>err &&\n    ++\t\ttest_grep \"feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n    ++\ttest_when_finished \"rm -rf repo\" &&\n    ++\tgit init repo &&\n    ++\t(\n    ++\t\tcd repo &&\n    ++\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" >input &&\n    ++\t\ttest_must_fail git fast-import <input 2>err &&\n    ++\t\ttest_grep \"feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features\" err\n    ++\t)\n    ++'\n    ++\n    ++test_expect_success 'Y: rewrite submodules via stdin' '\n    ++\ttest_when_finished \"rm -rf main1\" &&\n    ++\ttest_oid_cache <<-EOF &&\n    ++\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n    ++\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n    ++\tEOF\n    ++\n    ++\tgit init main1 &&\n    ++\t(\n    ++\t\tcd main1 &&\n    ++\t\tgit init sub2 &&\n    ++\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n    ++\t\t{\n    ++\t\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" &&\n    ++\t\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" &&\n    ++\t\t\tcat ../Y-main-input\n    ++\t\t} | git fast-import --allow-unsafe-features &&\n    ++\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n    ++\t)\n    ++'\n    ++\n     +test_done\n     \n      ## t/t9311-fast-import-refs.sh (new) ##\n20:  80524815fd ! 20:  26f81a22b7 t93xx: drop the series letter from the moved test names\n    @@ t/t9301-fast-import-notes.sh: echo \\\"\\$@\\\"\" &&\n      \tcommit3=$(git -C repo rev-parse notes-test)\n      }\n      \n    --test_expect_success 'Q: verify pack' '\n    -+test_expect_success 'verify pack' '\n    - \tsetup_notes_repo &&\n    - \t(\n    - \t\tcd repo &&\n    -@@ t/t9301-fast-import-notes.sh: test_expect_success 'Q: verify pack' '\n    - \t)\n    - '\n    - \n     -test_expect_success 'Q: verify first commit' '\n     +test_expect_success 'verify first commit' '\n      \tsetup_notes_repo &&\n    @@ t/t9307-fast-import-validation.sh: test_expect_success 'E: rfc2822 date, --date-\n      \ttest_when_finished \"rm -rf repo\" &&\n      \tgit init repo &&\n      \t(\n    +@@ t/t9307-fast-import-validation.sh: test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'R: --allow-unsafe-features found after a value' '\n    ++test_expect_success '--allow-unsafe-features found after a value' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: --allow-unsafe-features found after a value' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n    ++test_expect_success '--allow-unsafe-features can be abbreviated' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n    ++test_expect_success 'disallowed abbreviation of --allow-unsafe-features' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n    ++test_expect_success '--allow-unsafe-features as the value of an abbreviation' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation'\n    + \t)\n    + '\n    + \n    +-test_expect_success 'R: --allow-unsafe-features after a non-option' '\n    ++test_expect_success '--allow-unsafe-features after a non-option' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n     \n      ## t/t9308-fast-import-stream.sh ##\n     @@ t/t9308-fast-import-stream.sh: test_expect_success 'truncated stream complains' '\n    @@ t/t9308-fast-import-stream.sh: do\n      \ttest_when_finished \"rm -rf repo\" &&\n      \tgit init -b main repo &&\n      \t(\n    +@@ t/t9308-fast-import-stream.sh: test_expect_success 'I: export-pack-edges' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'I: export-pack-edges option forbidden by default' '\n    ++test_expect_success 'export-pack-edges option forbidden by default' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9308-fast-import-stream.sh: test_expect_success 'I: export-pack-edges option forbidden by default' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'I: export-pack-edges via stdin' '\n    ++test_expect_success 'export-pack-edges via stdin' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init -b main repo &&\n    + \t(\n    +@@ t/t9308-fast-import-stream.sh: test_expect_success 'I: export-pack-edges via stdin' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'R: --git-completion-helper does not read from stdin' '\n    ++test_expect_success '--git-completion-helper does not read from stdin' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9308-fast-import-stream.sh: test_expect_success 'R: --git-completion-helper does not read from stdin' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n    ++test_expect_success '--git-completion-helper-all does not read from stdin' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n     \n      ## t/t9309-fast-import-checkpoint.sh ##\n     @@ t/t9309-fast-import-checkpoint.sh: setup_checkpoint_repo () {\n    @@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: rewrite submodules' '\n      \ttest_oid_cache <<-EOF &&\n      \tpending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04\n      \tpending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d\n    +@@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: reference pending tag or commit' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n    ++test_expect_success 'rewrite-submodules-to feature forbidden by default' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n    ++test_expect_success 'rewrite-submodules-from feature forbidden by default' '\n    + \ttest_when_finished \"rm -rf repo\" &&\n    + \tgit init repo &&\n    + \t(\n    +@@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n    + \t)\n    + '\n    + \n    +-test_expect_success 'Y: rewrite submodules via stdin' '\n    ++test_expect_success 'rewrite submodules via stdin' '\n    + \ttest_when_finished \"rm -rf main1\" &&\n    + \ttest_oid_cache <<-EOF &&\n    + \tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n     \n      ## t/t9311-fast-import-refs.sh ##\n     @@ t/t9311-fast-import-refs.sh: setup_two_commit_repo () {\n\n---\nbase-commit: faeb455a72c105b44c92ebedae5e771bad5bc853\nchange-id: 20261102-kn-fast-import-tests-1-03de57101c3b\n\n\nThanks\n- Karthik\n\n\n"},{"id":"558304","messageId":"20261112-kn-fast-import-tests-1-v2-1-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 01/20] t9300: move 'fastimport.unpackLimit' to the required test","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:01Z","receivedAt":"2026-11-12T17:34:01Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'empty stream succeeds' test sets 'fastimport.unpackLimit' to '0',\nso that the following imports write packs for the 'verify pack' tests\nto check. The test itself doesn't need it. A following commit makes it\nrun in its own repository, where the setting would no longer reach the\ntests after it.\n\nMove the configuration to 'A: create pack from stdin', the first test\nwhich needs it. The configuration must persist for the 'verify pack'\ntests of the following series, so set it with 'git config' and not with\n'test_config'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 15f511fb6b..4cffe43a71 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -38,7 +38,6 @@ echo \"$@\"'\n ###\n \n test_expect_success 'empty stream succeeds' '\n-\tgit config fastimport.unpackLimit 0 &&\n \tgit fast-import </dev/null\n '\n \n@@ -47,6 +46,7 @@ test_expect_success 'truncated stream complains' '\n '\n \n test_expect_success 'A: create pack from stdin' '\n+\tgit config fastimport.unpackLimit 0 &&\n \ttest_tick &&\n \tcat >input <<-INPUT_END &&\n \tblob\n\n-- \n2.56.GIT\n\n\n"},{"id":"558305","messageId":"20261112-kn-fast-import-tests-1-v2-2-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 02/20] t9300: make the series B tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:02Z","receivedAt":"2026-11-12T17:34:02Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 't/t9300-fast-import.sh' test file contains numerous tests and is\ncurrently just shy of 4000 lines. This is because the file contains\ntests over multiple series, each series testing particular functionality\nor sections of 'git-fast-import(1)'. In upcoming commits, we want to\nsplit out these tests into individual files for better discoverability.\n\nFirst, we need to remove the dependency tests have on preceding tests.\nModify the tests in 'series B' to each run in a new repository, which is\nremoved when the test completes, so that they neither depend on nor\nleave behind any state.\n\nThe 'B: fail on invalid blob sha1' and 'B: accept branch name\n\"TEMP_TAG\"' tests import on top of 'main', which used to exist from\nearlier tests. Create it with 'test_commit', so that the first import\ncan only fail because of the invalid blob ID.\n\nThe 'fsck' tests require the whole repository to be free of unreachable\nobjects. They only passed because of the garbage collection in the\ncleanup of other tests. A new repository makes that unnecessary.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 472 ++++++++++++++++++++++++++++---------------------\n 1 file changed, 275 insertions(+), 197 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 4cffe43a71..e2cf0b7a22 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -358,274 +358,352 @@ test_expect_success 'A: export marks with large values' '\n ###\n \n test_expect_success 'B: fail on invalid blob sha1' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tmark :1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcorrupt\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit base &&\n \n-\tfrom refs/heads/main\n-\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/branch\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/main\n+\t\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n \n-\ttest_when_finished \"rm -f .git/objects/pack_* .git/objects/index_*\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit TEMP_TAG\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\ttag base\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit new &&\n \n-\tfrom refs/heads/main\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit TEMP_TAG\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttag base\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/main\n \n-\ttest_when_finished \"rm -f .git/TEMP_TAG && git gc --prune=now\" &&\n-\tgit fast-import <input &&\n-\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n-\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n+\t\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n+\t)\n '\n \n test_expect_success 'B: accept empty committer' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/empty-committer-1\n-\tcommitter  <> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-1\n+\t\tcommitter  <> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n \n-\ttest_when_finished \"git update-ref -d refs/heads/empty-committer-1\n-\t\tgit gc --prune=now\" &&\n-\tgit fast-import <input &&\n-\tout=$(git fsck) &&\n-\techo \"$out\" &&\n-\ttest -z \"$out\"\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n '\n \n test_expect_success 'B: reject invalid timezone' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-timezone\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-timezone\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: accept invalid timezone with raw-permissive' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-timezone\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit init invalid-timezone &&\n-\tgit -C invalid-timezone fast-import --date-format=raw-permissive <input &&\n-\tgit -C invalid-timezone cat-file -p invalid-timezone >out &&\n-\ttest_grep \"1234567890 [+]051800\" out\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import --date-format=raw-permissive <input &&\n+\t\tgit cat-file -p invalid-timezone >out &&\n+\t\ttest_grep \"1234567890 [+]051800\" out\n+\t)\n '\n \n test_expect_success 'B: accept and fixup committer with no name' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/empty-committer-2\n-\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-2\n+\t\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n \n-\ttest_when_finished \"git update-ref -d refs/heads/empty-committer-2\n-\t\tgit gc --prune=now\" &&\n-\tgit fast-import <input &&\n-\tout=$(git fsck) &&\n-\techo \"$out\" &&\n-\ttest -z \"$out\"\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (1)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (2)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (3)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name <email>> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email>> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (4)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name <email $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid committer (5)' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/invalid-committer\n-\tcommitter Name<email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tempty commit\n-\tCOMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name<email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of ..' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 100644 :1 ../invalid-path\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 ../invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of .' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tGood path\n-\tCOMMIT\n-\tM 100644 :1 ok-path\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tBad path\n-\tCOMMIT\n-\tR ok-path ./invalid-path\n-\tINPUT_END\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tGood path\n+\t\tCOMMIT\n+\t\tM 100644 :1 ok-path\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tBad path\n+\t\tCOMMIT\n+\t\tR ok-path ./invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 100644 :1 C:/invalid-path\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 C:/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of .git' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 100644 :1 .git/invalid-path\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 .git/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'B: fail on invalid file path of .gitmodules' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<EOF\n-\tFile contents\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/badpath\n-\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tCommit Message\n-\tCOMMIT\n-\tM 120000 :1 .gitmodules\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n \n-\ttest_when_finished \"git update-ref -d refs/heads/badpath\" &&\n-\ttest_must_fail git fast-import <input\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 120000 :1 .gitmodules\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558306","messageId":"20261112-kn-fast-import-tests-1-v2-3-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 03/20] t9300: make the series T tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:03Z","receivedAt":"2026-11-12T17:34:03Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commit, modify the tests in 'series T' to make\nthem independent of state from preceding tests.\n\nThe 'ls root' tests list the root tree of the 'S' branch, using the\nmarks left behind by series S. The expected output is derived from the\ncommit itself, so any commit will do. Run them against a commit created\nin a new repository instead. Run the branch tests in a new repository\ntoo.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 62 +++++++++++++++++++++++++++++++++-----------------\n 1 file changed, 41 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex e2cf0b7a22..a0e322b866 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3602,38 +3602,58 @@ test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n ###\n ### series T (ls)\n ###\n-# Setup is carried over from series S.\n \n for root in '\"\"' ''\n do\n \ttest_expect_success \"T: ls root ($root) tree\" '\n-\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n-\t\t040000 tree $(git rev-parse S^{tree})\tZ\n-\t\tEOF\n-\t\tsha1=$(git rev-parse --verify S) &&\n-\t\tgit fast-import --import-marks=marks <<-EOF >actual &&\n-\t\tls $sha1 $root\n-\t\tEOF\n-\t\ttest_cmp expect actual\n+\t\ttest_when_finished \"rm -rf repo\" &&\n+\t\tgit init repo &&\n+\t\t(\n+\t\t\tcd repo &&\n+\t\t\ttest_commit one &&\n+\n+\t\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n+\t\t\t040000 tree $(git rev-parse HEAD^{tree})\tZ\n+\t\t\tEOF\n+\t\t\tsha1=$(git rev-parse --verify HEAD) &&\n+\t\t\tgit fast-import <<-EOF >actual &&\n+\t\t\tls $sha1 $root\n+\t\t\tEOF\n+\t\t\ttest_cmp expect actual\n+\t\t)\n \t'\n done\n \n test_expect_success 'T: delete branch' '\n-\tgit branch to-delete &&\n-\tgit fast-import <<-EOF &&\n-\treset refs/heads/to-delete\n-\tfrom $ZERO_OID\n-\tEOF\n-\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/to-delete\n+\t\tfrom $ZERO_OID\n+\t\tEOF\n+\t\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n+\t)\n '\n \n test_expect_success 'T: empty reset doesnt delete branch' '\n-\tgit branch not-to-delete &&\n-\tgit fast-import <<-EOF &&\n-\treset refs/heads/not-to-delete\n-\tEOF\n-\tgit show-ref &&\n-\tgit rev-parse --verify refs/heads/not-to-delete\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch not-to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/not-to-delete\n+\t\tEOF\n+\t\tgit show-ref &&\n+\t\tgit rev-parse --verify refs/heads/not-to-delete\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558307","messageId":"20261112-kn-fast-import-tests-1-v2-4-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 04/20] t9300: make the series S tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:04Z","receivedAt":"2026-11-12T17:34:04Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series S' to make\nthem independent of state from previous tests.\n\nReplace the 'S: initialize for S tests' test with a\n'setup_marks_repo()' function, so each test can invoke it to setup its\nown repo and tear it down when the test completes.\n\n'S: from with garbage after mark must fail' used to create the 'S2'\ncommit which 'S: merge with garbage after mark must fail' needs. Create\nthat commit in the merge test instead.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 332 +++++++++++++++++++++++++++++--------------------\n 1 file changed, 198 insertions(+), 134 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex a0e322b866..f9359bbaf3 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3100,10 +3100,12 @@ test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n #\n #   invalid dataref ..\n #\n-test_expect_success 'S: initialize for S tests' '\n+setup_marks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \ttest_tick &&\n \n-\tcat >input <<-INPUT_END &&\n+\tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/S\n \tmark :301\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n@@ -3140,142 +3142,168 @@ test_expect_success 'S: initialize for S tests' '\n \tBLOB\n \tINPUT_END\n \n-\tgit fast-import --export-marks=marks <input\n-'\n+\tgit -C repo fast-import --export-marks=marks <repo/input\n+}\n \n #\n # filemodify, three datarefs\n #\n test_expect_success 'S: filemodify with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit N\n-\tCOMMIT\n-\tM 100644 :403x hello.c\n-\tEOF\n-\ttest_grep \"space after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 :403x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n '\n \n # inline is misspelled; fast-import thinks it is some unknown dataref\n test_expect_success 'S: filemodify with garbage after inline must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit N\n-\tCOMMIT\n-\tM 100644 inlineX hello.c\n-\tdata <<BLOB\n-\tinline\n-\tBLOB\n-\tEOF\n-\ttest_grep \"nvalid dataref\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 inlineX hello.c\n+\t\tdata <<BLOB\n+\t\tinline\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n '\n \n test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n-\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit N\n-\tCOMMIT\n-\tM 100644 ${sha1}x hello.c\n-\tEOF\n-\ttest_grep \"space after SHA1\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n '\n \n #\n # notemodify, three ways to say dataref\n #\n test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note dataref markref\n-\tCOMMIT\n-\tN :202x :302\n-\tEOF\n-\ttest_grep \"space after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref markref\n+\t\tCOMMIT\n+\t\tN :202x :302\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n '\n \n test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note dataref inline\n-\tCOMMIT\n-\tN inlineX :302\n-\tdata <<BLOB\n-\tnote blob\n-\tBLOB\n-\tEOF\n-\ttest_grep \"nvalid dataref\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref inline\n+\t\tCOMMIT\n+\t\tN inlineX :302\n+\t\tdata <<BLOB\n+\t\tnote blob\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n '\n \n test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n-\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note dataref sha1\n-\tCOMMIT\n-\tN ${sha1}x :302\n-\tEOF\n-\ttest_grep \"space after SHA1\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref sha1\n+\t\tCOMMIT\n+\t\tN ${sha1}x :302\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n '\n \n #\n # notemodify, mark in commit-ish\n #\n test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/Snotes\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit S note commit-ish\n-\tCOMMIT\n-\tN :202 :302x\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/Snotes\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note commit-ish\n+\t\tCOMMIT\n+\t\tN :202 :302x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # from\n #\n test_expect_success 'S: from with garbage after mark must fail' '\n-\ttest_must_fail \\\n-\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S2\n-\tmark :303\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 3\n-\tCOMMIT\n-\tfrom :301x\n-\tM 100644 :403 hello.c\n-\tEOF\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n \n+\t\ttest_must_fail \\\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n \n-\t# go create the commit, need it for merge test\n-\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n-\tcommit refs/heads/S2\n-\tmark :303\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 3\n-\tCOMMIT\n-\tfrom :301\n-\tM 100644 :403 hello.c\n-\tEOF\n-\n-\t# now evaluate the error\n-\ttest_grep \"after mark\" err\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n \n@@ -3283,61 +3311,97 @@ test_expect_success 'S: from with garbage after mark must fail' '\n # merge\n #\n test_expect_success 'S: merge with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcommit refs/heads/S\n-\tmark :304\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tmerge 4\n-\tCOMMIT\n-\tfrom :302\n-\tmerge :303x\n-\tM 100644 :403 hello.c\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tmark :304\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tmerge 4\n+\t\tCOMMIT\n+\t\tfrom :302\n+\t\tmerge :303x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # tag, from markref\n #\n test_expect_success 'S: tag with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\ttag refs/tags/Stag\n-\tfrom :302x\n-\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<TAG\n-\ttag S\n-\tTAG\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\ttag refs/tags/Stag\n+\t\tfrom :302x\n+\t\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<TAG\n+\t\ttag S\n+\t\tTAG\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # cat-blob markref\n #\n test_expect_success 'S: cat-blob with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tcat-blob :403x\n-\tEOF\n-\ttest_grep \"after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcat-blob :403x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n '\n \n #\n # ls markref\n #\n test_expect_success 'S: ls with garbage after mark must fail' '\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tls :302x hello.c\n-\tEOF\n-\ttest_grep \"space after mark\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls :302x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n '\n \n test_expect_success 'S: ls with garbage after sha1 must fail' '\n-\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n-\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\tls ${sha1}x hello.c\n-\tEOF\n-\ttest_grep \"space after tree-ish\" err\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after tree-ish\" err\n+\t)\n '\n \n #\n\n-- \n2.56.GIT\n\n\n"},{"id":"558308","messageId":"20261112-kn-fast-import-tests-1-v2-5-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 05/20] t9300: make the series V tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:05Z","receivedAt":"2026-11-12T17:34:05Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series V' to make\nthem independent of state from previous tests.\n\nMove the setup to a 'setup_checkpoint_repo()' function, so each test can\ninvoke it. The tests used to build on the 'U' branch from series U, so\nlet the function create a 'base' commit instead. For the same reason,\nthe tag test now tags 'base' and not 'V'.\n\n'background_import_then_checkpoint()' registers a cleanup with\n'test_when_finished', which is not allowed in a subshell, so call it\nfrom the main shell.\n\nThe 'no new objects' test needs the 'V' commit in a pack, because\nfast-import only detects duplicates against packs and not against loose\nobjects. It used to rely on the 'fastimport.unpackLimit' set by an\nearlier test, so create the commit in the test with\n'fastimport.unpackLimit' set to 0.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 80 ++++++++++++++++++++++++++++++++++----------------\n 1 file changed, 55 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex f9359bbaf3..809a5a59c5 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3854,7 +3854,7 @@ background_import_then_checkpoint () {\n \trm V.output\n \n \t(\n-\t\tgit fast-import $options <&8 >&9 &\n+\t\tgit -C repo fast-import $options <&8 >&9 &\n \t\techo $! >&9\n \t\twait $!\n \t\techo >&2 \"background fast-import terminated too early with exit code $?\"\n@@ -3906,80 +3906,110 @@ background_import_still_running () {\n \tfi\n }\n \n+setup_checkpoint_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_tick &&\n+\tgit -C repo fast-import <<-INPUT_END\n+\tcommit refs/heads/base\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tbase commit\n+\tCOMMIT\n+\tINPUT_END\n+}\n+\n test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n \tprogress foo\n \tprogress bar\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"\" input &&\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n \tbackground_import_still_running\n '\n \n test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n-\tcat >input <<-\\INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-\\INPUT_END &&\n \treset refs/heads/V\n-\tfrom refs/heads/U\n+\tfrom refs/heads/base\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"\" input &&\n-\ttest \"$(git rev-parse --verify V)\" = \"$(git rev-parse --verify U)\" &&\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\ttest \"$(git -C repo rev-parse --verify V)\" = \"$(git -C repo rev-parse --verify base)\" &&\n \tbackground_import_still_running\n '\n \n test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/V\n \tmark :1\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata 0\n-\tfrom refs/heads/U\n+\tfrom refs/heads/base\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" input &&\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n \n-\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n-\n-\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify U)\" &&\n-\ttest_cmp marks.expected marks.actual &&\n+\t\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify base)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n \tbackground_import_still_running\n '\n \n # Re-create the exact same commit, but on a different branch: no new object is\n # created in the database, but the refs and marks still need to be updated.\n test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n+\tcommit refs/heads/V\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/V2\n \tmark :2\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata 0\n-\tfrom refs/heads/U\n+\tfrom refs/heads/base\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" input &&\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n \n-\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n-\n-\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n-\ttest_cmp marks.expected marks.actual &&\n+\t\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n \tbackground_import_still_running\n '\n \n test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n-\tcat >input <<-INPUT_END &&\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n \ttag Vtag\n-\tfrom refs/heads/V\n+\tfrom refs/heads/base\n \ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata 0\n \n \tINPUT_END\n \n-\tbackground_import_then_checkpoint \"\" input &&\n-\tgit show-ref -d Vtag &&\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\tgit -C repo show-ref -d Vtag &&\n \tbackground_import_still_running\n '\n \n\n-- \n2.56.GIT\n\n\n"},{"id":"558309","messageId":"20261112-kn-fast-import-tests-1-v2-6-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 06/20] t9300: make the series Q tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:06Z","receivedAt":"2026-11-12T17:34:06Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series Q' to make\nthem independent of state from previous tests.\n\nThe 'Q: verify' tests inspect the commits and notes written by 'Q:\ncommit notes', and use shell variables set by the preceding tests.\nReplace 'Q: commit notes' with a 'setup_notes_repo()' function, which\ncreates a new repository, runs the import and sets those variables, so\neach test can invoke it.\n\nDrop 'Q: verify pack', as other tests already verify the packs written\nby fast-import.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 339 +++++++++++++++++++++++++++++++------------------\n 1 file changed, 212 insertions(+), 127 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 809a5a59c5..a85e3e0757 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2048,7 +2048,17 @@ test_expect_success 'P: fail on blob mark in gitlink' '\n ### series Q (notes)\n ###\n \n-test_expect_success 'Q: commit notes' '\n+setup_notes_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tfile2_data=\"file2\n+second line of EOF\" &&\n+\tfile4_data=abcd &&\n+\tfile4_len=4 &&\n+\tfile5_data=\"an inline file.\n+  we should see it later.\" &&\n+\tfile6_data=\"#!/bin/sh\n+echo \\\"\\$@\\\"\" &&\n \tnote1_data=\"The first note for the first commit\" &&\n \tnote2_data=\"The first note for the second commit\" &&\n \tnote3_data=\"The first note for the third commit\" &&\n@@ -2057,7 +2067,7 @@ test_expect_success 'Q: commit notes' '\n \tnote2b_data=\"The second note for the second commit\" &&\n \n \ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n+\tcat >repo/input <<-INPUT_END &&\n \tblob\n \tmark :2\n \tdata <<EOF\n@@ -2168,199 +2178,274 @@ test_expect_success 'Q: commit notes' '\n \n \tINPUT_END\n \n-\tgit fast-import <input &&\n-\tgit log --raw notes-test\n-'\n-\n-test_expect_success 'Q: verify pack' '\n-\tverify_packs\n-'\n+\tgit -C repo fast-import <repo/input &&\n+\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n+\tcommit2=$(git -C repo rev-parse notes-test^) &&\n+\tcommit3=$(git -C repo rev-parse notes-test)\n+}\n \n test_expect_success 'Q: verify first commit' '\n-\tcommit1=$(git rev-parse notes-test~2) &&\n-\tcommit2=$(git rev-parse notes-test^) &&\n-\tcommit3=$(git rev-parse notes-test) &&\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\tfirst (:3)\n-\tEOF\n-\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tfirst (:3)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $commit1\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit1\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tsecond (:5)\n-\tEOF\n-\tgit cat-file commit notes-test^ | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tsecond (:5)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $commit2\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit2\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tthird (:6)\n-\tEOF\n-\tgit cat-file commit notes-test | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tthird (:6)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first notes commit' '\n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:9)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:9)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit1\n-\t100644 blob $commit2\n-\t100644 blob $commit3\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for first commit' '\n-\techo \"$note1_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for second commit' '\n-\techo \"$note2_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for third commit' '\n-\techo \"$note3_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second notes commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $(git rev-parse --verify refs/notes/foobar~2)\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar~2)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:10)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:10)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit1\n-\t100644 blob $commit2\n-\t100644 blob $commit3\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second note for first commit' '\n-\techo \"$note1b_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for second commit' '\n-\techo \"$note2_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify first note for third commit' '\n-\techo \"$note3_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third notes commit' '\n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:11)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:11)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit1\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify third note for first commit' '\n-\techo \"$note1c_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1c_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify fourth notes commit' '\n-\tcat >expect <<-EOF &&\n-\tparent $(git rev-parse --verify refs/notes/foobar^)\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar^)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tnotes (:12)\n-\tEOF\n-\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n-\ttest_cmp expect actual\n+\t\tnotes (:12)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify fourth notes tree' '\n-\tsort >expect <<-EOF &&\n-\t100644 blob $commit2\n-\tEOF\n-\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit2\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: verify second note for second commit' '\n-\techo \"$note2b_data\" >expect &&\n-\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n-\ttest_cmp expect actual\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'Q: deny note on empty branch' '\n-\tcat >input <<-EOF &&\n-\treset refs/heads/Q0\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-EOF &&\n+\t\treset refs/heads/Q0\n \n-\tcommit refs/heads/note-Q0\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tNote for an empty branch.\n-\tCOMMIT\n+\t\tcommit refs/heads/note-Q0\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tNote for an empty branch.\n+\t\tCOMMIT\n \n-\tN inline refs/heads/Q0\n-\tdata <<NOTE\n-\tsome note\n-\tNOTE\n-\tEOF\n-\ttest_must_fail git fast-import <input\n+\t\tN inline refs/heads/Q0\n+\t\tdata <<NOTE\n+\t\tsome note\n+\t\tNOTE\n+\t\tEOF\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558310","messageId":"20261112-kn-fast-import-tests-1-v2-7-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 07/20] t9300: make the series P tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:07Z","receivedAt":"2026-11-12T17:34:07Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series P' to make\nthem independent of state from previous tests.\n\nMove the setup to a 'setup_gitlinks_repo()' function, so each test can\ninvoke it.\n\nThe 'fail on inline gitlink' and 'fail on blob mark in gitlink' tests\ncreate their commit on top of 'subuse2', which is only written by the\n'verbatim SHA gitlinks' test. Use 'subuse1' from the setup instead, as\nthese tests only check that the invalid gitlink is rejected.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 290 +++++++++++++++++++++++++++----------------------\n 1 file changed, 161 insertions(+), 129 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex a85e3e0757..920fcd52b5 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1891,157 +1891,189 @@ test_expect_success 'O: progress outputs as requested by input' '\n ### series P (gitlinks)\n ###\n \n-test_expect_success 'P: superproject & submodule mix' '\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata 10\n-\ttest file\n-\n-\treset refs/heads/sub\n-\tcommit refs/heads/sub\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 12\n-\tsub_initial\n-\tM 100644 :1 file\n-\n-\tblob\n-\tmark :3\n-\tdata <<DATAEND\n-\t[submodule \"sub\"]\n-\t\tpath = sub\n-\t\turl = \"$(pwd)/sub\"\n-\tDATAEND\n-\n-\tcommit refs/heads/subuse1\n-\tmark :4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 8\n-\tinitial\n-\tfrom refs/heads/main\n-\tM 100644 :3 .gitmodules\n-\tM 160000 :2 sub\n-\n-\tblob\n-\tmark :5\n-\tdata 20\n-\ttest file\n-\tmore data\n-\n-\tcommit refs/heads/sub\n-\tmark :6\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 11\n-\tsub_second\n-\tfrom :2\n-\tM 100644 :5 file\n-\n-\tcommit refs/heads/subuse1\n-\tmark :7\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 7\n-\tsecond\n-\tfrom :4\n-\tM 160000 :6 sub\n-\n-\tINPUT_END\n-\n-\tgit fast-import <input &&\n-\tgit checkout subuse1 &&\n-\trm -rf sub &&\n-\tmkdir sub &&\n+setup_gitlinks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo base &&\n \t(\n-\t\tcd sub &&\n-\t\tgit init &&\n-\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n-\t\tgit checkout main\n-\t) &&\n-\tgit submodule init &&\n-\tgit submodule update\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 10\n+\t\ttest file\n+\n+\t\treset refs/heads/sub\n+\t\tcommit refs/heads/sub\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 12\n+\t\tsub_initial\n+\t\tM 100644 :1 file\n+\n+\t\tblob\n+\t\tmark :3\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :3 .gitmodules\n+\t\tM 160000 :2 sub\n+\n+\t\tblob\n+\t\tmark :5\n+\t\tdata 20\n+\t\ttest file\n+\t\tmore data\n+\n+\t\tcommit refs/heads/sub\n+\t\tmark :6\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 11\n+\t\tsub_second\n+\t\tfrom :2\n+\t\tM 100644 :5 file\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :7\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :4\n+\t\tM 160000 :6 sub\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input\n+\t)\n+}\n+\n+test_expect_success 'P: superproject & submodule mix' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit checkout subuse1 &&\n+\t\trm -rf sub &&\n+\t\tmkdir sub &&\n+\t\t(\n+\t\t\tcd sub &&\n+\t\t\tgit init &&\n+\t\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n+\t\t\tgit checkout main\n+\t\t) &&\n+\t\tgit submodule init &&\n+\t\tgit submodule update\n+\t)\n '\n \n test_expect_success 'P: verbatim SHA gitlinks' '\n-\tSUBLAST=$(git rev-parse --verify sub) &&\n-\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<DATAEND\n-\t[submodule \"sub\"]\n-\t\tpath = sub\n-\t\turl = \"$(pwd)/sub\"\n-\tDATAEND\n+\t\tSUBLAST=$(git rev-parse --verify sub) &&\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n \n-\tcommit refs/heads/subuse2\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 8\n-\tinitial\n-\tfrom refs/heads/main\n-\tM 100644 :1 .gitmodules\n-\tM 160000 $SUBPREV sub\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n \n-\tcommit refs/heads/subuse2\n-\tmark :3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 7\n-\tsecond\n-\tfrom :2\n-\tM 160000 $SUBLAST sub\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :1 .gitmodules\n+\t\tM 160000 $SUBPREV sub\n \n-\tINPUT_END\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :2\n+\t\tM 160000 $SUBLAST sub\n \n-\tgit branch -D sub &&\n-\tgit gc --prune=now &&\n-\tgit fast-import <input &&\n-\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n+\t\tINPUT_END\n+\n+\t\tgit branch -D sub &&\n+\t\tgit gc --prune=now &&\n+\t\tgit fast-import <input &&\n+\t\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n+\t)\n '\n \n test_expect_success 'P: fail on inline gitlink' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/subuse3\n-\tmark :1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcorrupt\n-\tCOMMIT\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tfrom refs/heads/subuse2\n-\tM 160000 inline sub\n-\tdata <<DATA\n-\t$SUBPREV\n-\tDATA\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 inline sub\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n \n-\ttest_must_fail git fast-import <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'P: fail on blob mark in gitlink' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tblob\n-\tmark :1\n-\tdata <<DATA\n-\t$SUBPREV\n-\tDATA\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcommit refs/heads/subuse3\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcorrupt\n-\tCOMMIT\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n \n-\tfrom refs/heads/subuse2\n-\tM 160000 :1 sub\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 :1 sub\n \n-\ttest_must_fail git fast-import <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558311","messageId":"20261112-kn-fast-import-tests-1-v2-8-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 08/20] t9300: make the series O tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:08Z","receivedAt":"2026-11-12T17:34:08Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series O' to make\nthem independent of state from previous tests.\n\nThe tests import on top of 'branch' and compare the result against the\n'N3' commit from series N. Import on top of a commit created by the new\n'setup_import_repo()' function instead, and compare the result against\nthe same commit imported from a stream without comments and with blank\nlines, so that the whole commit is still checked and not just its tree.\nThe function sets 'fastimport.unpackLimit' to 0, which 'O: blank lines\nnot necessary after other commands' relies on.\n\nDrop the 'O: repack before next test' test, and repack in the test\nwhich relies on it.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 291 +++++++++++++++++++++++++++++++------------------\n 1 file changed, 182 insertions(+), 109 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 920fcd52b5..e0b9663452 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1748,143 +1748,216 @@ done\n ### series O\n ###\n \n-test_expect_success 'O: comments are all skipped' '\n-\tcat >input <<-INPUT_END &&\n-\t#we will\n-\tcommit refs/heads/O1\n-\t# -- ignore all of this text\n+setup_import_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tgit -C repo config fastimport.unpackLimit 0 &&\n+\tmkdir repo/file2 &&\n+\techo abcd >repo/file2/file4 &&\n+\tgit -C repo add file2/file4 &&\n+\ttest_tick &&\n+\tgit -C repo commit -m base\n+}\n+\n+import_reference_commit () {\n+\tgit fast-import <<-INPUT_END\n+\tcommit refs/heads/$1\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata <<COMMIT\n \tdirty directory copy\n \tCOMMIT\n \n-\t# do not forget the import blank line!\n-\t#\n-\t# yes, we started from our usual base of branch^0.\n-\t# i like branch^0.\n-\tfrom refs/heads/branch^0\n-\t# and we need to reuse file2/file5 from N3 above.\n+\tfrom refs/heads/main\n \tM 644 inline file2/file5\n-\t# otherwise the tree will be different\n \tdata <<EOF\n-\t$file5_data\n+\tan inline file.\n+\t  we should see it later.\n \tEOF\n \n-\t# do not forget to copy file2 to file3\n \tC file2 file3\n-\t#\n-\t# or to delete file5 from file2.\n \tD file2/file5\n-\t# are we done yet?\n \n \tINPUT_END\n+}\n \n-\tgit fast-import <input &&\n-\ttest $(git rev-parse N3) = $(git rev-parse O1)\n+test_expect_success 'O: comments are all skipped' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\t#we will\n+\t\tcommit refs/heads/O1\n+\t\t# -- ignore all of this text\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\n+\t\t# do not forget the import blank line!\n+\t\t#\n+\t\t# yes, we started from our usual base of main.\n+\t\t# i like main.\n+\t\tfrom refs/heads/main\n+\t\t# and we need to add file2/file5 to file2.\n+\t\tM 644 inline file2/file5\n+\t\t# otherwise the tree will be different\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\n+\t\t# do not forget to copy file2 to file3\n+\t\tC file2 file3\n+\t\t#\n+\t\t# or to delete file5 from file2.\n+\t\tD file2/file5\n+\t\t# are we done yet?\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O1 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O1-reference &&\n+\t\ttest_cmp_rev O1-reference O1\n+\t)\n '\n \n test_expect_success 'O: blank lines not necessary after data commands' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/O2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tdirty directory copy\n-\tCOMMIT\n-\tfrom refs/heads/branch^0\n-\tM 644 inline file2/file5\n-\tdata <<EOF\n-\t$file5_data\n-\tEOF\n-\tC file2 file3\n-\tD file2/file5\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\t\tfrom refs/heads/main\n+\t\tM 644 inline file2/file5\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\t\tC file2 file3\n+\t\tD file2/file5\n \n-\tgit fast-import <input &&\n-\ttest $(git rev-parse N3) = $(git rev-parse O2)\n-'\n+\t\tINPUT_END\n \n-test_expect_success 'O: repack before next test' '\n-\tgit repack -a -d\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O2 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O2-reference &&\n+\t\ttest_cmp_rev O2-reference O2\n+\t)\n '\n \n test_expect_success 'O: blank lines not necessary after other commands' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/O3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzstring\n-\tCOMMIT\n-\tcommit refs/heads/O3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzof\n-\tCOMMIT\n-\tcheckpoint\n-\tcommit refs/heads/O3\n-\tmark :5\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzempty\n-\tCOMMIT\n-\tcheckpoint\n-\tcommit refs/heads/O3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzcommits\n-\tCOMMIT\n-\treset refs/tags/O3-2nd\n-\tfrom :5\n-\treset refs/tags/O3-3rd\n-\tfrom :5\n-\tINPUT_END\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tgit repack -a -d &&\n \n-\tcat >expect <<-INPUT_END &&\n-\tstring\n-\tof\n-\tempty\n-\tcommits\n-\tINPUT_END\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tmark :5\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\treset refs/tags/O3-2nd\n+\t\tfrom :5\n+\t\treset refs/tags/O3-3rd\n+\t\tfrom :5\n+\t\tINPUT_END\n \n-\tgit fast-import <input &&\n-\tls -la .git/objects/pack/pack-*.pack >packlist &&\n-\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n-\ttest_line_count = 4 idxlist &&\n-\ttest_line_count = 4 packlist &&\n-\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n-\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n-\ttest_cmp expect actual\n+\t\tcat >expect <<-INPUT_END &&\n+\t\tstring\n+\t\tof\n+\t\tempty\n+\t\tcommits\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tls -la .git/objects/pack/pack-*.pack >packlist &&\n+\t\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n+\t\ttest_line_count = 4 idxlist &&\n+\t\ttest_line_count = 4 packlist &&\n+\t\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n+\t\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'O: progress outputs as requested by input' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzstring\n-\tCOMMIT\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzof\n-\tCOMMIT\n-\tprogress Two commits down, 2 to go!\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzempty\n-\tCOMMIT\n-\tprogress Three commits down, 1 to go!\n-\tcommit refs/heads/O4\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tzcommits\n-\tCOMMIT\n-\tprogress done!\n-\tINPUT_END\n-\tgit fast-import <input >actual &&\n-\tgrep \"progress \" <input >expect &&\n-\ttest_cmp expect actual\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tprogress Two commits down, 2 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tprogress Three commits down, 1 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\tprogress done!\n+\t\tINPUT_END\n+\t\tgit fast-import <input >actual &&\n+\t\tgrep \"progress \" <input >expect &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558312","messageId":"20261112-kn-fast-import-tests-1-v2-9-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 09/20] t9300: make the big blob tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:09Z","receivedAt":"2026-11-12T17:34:09Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the big blob tests in 'series R'\nto make them independent of state from previous tests.\n\n'R: blob bigger than threshold' imports the blobs, and the tests after\nit inspect the result. Fold them into a single test, which does the\nimport and checks the pack, the blob contents and that the blob is\nstored only once.\n\nSet 'fastimport.unpackLimit' to 0 for the import so that a pack is\nwritten, and verify it with an inline loop in place of 'verify_packs()',\nwhich won't be available once the test is moved to another file.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 79 ++++++++++++++++++++++++--------------------------\n 1 file changed, 38 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex e0b9663452..2231e1bdab 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3198,51 +3198,48 @@ test_expect_success 'R: corrupt lines do not mess marks file' '\n ## R: very large blobs\n ##\n test_expect_success 'R: blob bigger than threshold' '\n-\tblobsize=$((2*1024*1024 + 53)) &&\n-\ttest-tool genrandom bar $blobsize >expect &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/big-file\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tR - big file\n-\tCOMMIT\n-\n-\tM 644 inline big1\n-\tdata $blobsize\n-\tINPUT_END\n-\tcat expect >>input &&\n-\tcat >>input <<-INPUT_END &&\n-\tM 644 inline big2\n-\tdata $blobsize\n-\tINPUT_END\n-\tcat expect >>input &&\n-\techo >>input &&\n-\n-\ttest_create_repo R &&\n-\tgit --git-dir=R/.git config fastimport.unpackLimit 0 &&\n-\tgit --git-dir=R/.git fast-import --big-file-threshold=1 <input\n-'\n-\n-test_expect_success 'R: verify created pack' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\tcd R &&\n-\t\tverify_packs -v > ../verify\n+\t\tcd repo &&\n+\n+\t\tblobsize=$((2*1024*1024 + 53)) &&\n+\t\ttest-tool genrandom bar $blobsize >expect &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/big-file\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tR - big file\n+\t\tCOMMIT\n+\n+\t\tM 644 inline big1\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\tcat >>input <<-INPUT_END &&\n+\t\tM 644 inline big2\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\techo >>input &&\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --big-file-threshold=1 <input &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack -v \"$p\" || return 1\n+\t\tdone >verify &&\n+\n+\t\tgit cat-file blob big-file:big1 >actual &&\n+\t\ttest_cmp_bin expect actual &&\n+\t\ta=$(git rev-parse big-file:big1) &&\n+\t\tb=$(git rev-parse big-file:big2) &&\n+\t\ttest $a = $b &&\n+\t\tn=$(grep $a verify | wc -l) &&\n+\t\ttest 1 = $n\n \t)\n '\n \n-test_expect_success 'R: verify written objects' '\n-\tgit --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n-\ttest_cmp_bin expect actual &&\n-\ta=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n-\tb=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n-\ttest $a = $b\n-'\n-\n-test_expect_success 'R: blob appears only once' '\n-\tn=$(grep $a verify | wc -l) &&\n-\ttest 1 = $n\n-'\n-\n test_expect_success 'R: --git-completion-helper does not read from stdin' '\n \tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n \techo garbage | git fast-import --git-completion-helper >out &&\n\n-- \n2.56.GIT\n\n\n"},{"id":"558313","messageId":"20261112-kn-fast-import-tests-1-v2-10-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 10/20] t9300: make the ref update tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:10Z","receivedAt":"2026-11-12T17:34:10Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the reference update tests in\nseries 'F', 'G', 'J' and 'K' to make them independent of state from\nprevious tests. Add a 'setup_two_commit_repo()' function which creates\na repository with two commits on 'main', so each test can invoke it.\n\nFold the tests which only check the result of an import into the tests\nperforming it, as they can't run on their own. As\n'fastimport.unpackLimit' is no longer set by an earlier test, set it for\nthe 'F' and 'G' imports so that a pack is written, and verify it with an\ninline loop in place of 'verify_packs()'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 214 +++++++++++++++++++++++++++----------------------\n 1 file changed, 119 insertions(+), 95 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 2231e1bdab..446cf0c51a 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -865,43 +865,53 @@ test_expect_success 'E: verify commit' '\n ### series F\n ###\n \n+setup_two_commit_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo one &&\n+\ttest_commit -C repo two\n+}\n+\n test_expect_success 'F: non-fast-forward update skips' '\n-\told_branch=$(git rev-parse --verify branch^0) &&\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tlosing things already?\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch~1\n+\t\tfrom refs/heads/main~1\n \n-\treset refs/heads/other\n-\tfrom refs/heads/branch\n+\t\treset refs/heads/other\n+\t\tfrom refs/heads/main\n \n-\tINPUT_END\n+\t\tINPUT_END\n \n-\ttest_must_fail git fast-import <input &&\n-\t# branch must remain unaffected\n-\ttest $old_branch = $(git rev-parse --verify branch^0)\n-'\n+\t\ttest_must_fail git -c fastimport.unpackLimit=0 fast-import <input &&\n+\t\t# branch must remain unaffected\n+\t\ttest $old_branch = $(git rev-parse --verify main^0) &&\n \n-test_expect_success 'F: verify pack' '\n-\tverify_packs\n-'\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone &&\n \n-test_expect_success 'F: verify other commit' '\n-\tcat >expect <<-EOF &&\n-\ttree $(git rev-parse branch~1^{tree})\n-\tparent $(git rev-parse branch~1)\n-\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcat >expect <<-EOF &&\n+\t\ttree $(git rev-parse main~1^{tree})\n+\t\tparent $(git rev-parse main~1)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n-\tlosing things already?\n-\tEOF\n-\tgit cat-file commit other >actual &&\n-\ttest_cmp expect actual\n+\t\tlosing things already?\n+\t\tEOF\n+\t\tgit cat-file commit other >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n ###\n@@ -909,28 +919,31 @@ test_expect_success 'F: verify other commit' '\n ###\n \n test_expect_success 'G: non-fast-forward update forced' '\n-\told_branch=$(git rev-parse --verify branch^0) &&\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tlosing things already?\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch~1\n+\t\tfrom refs/heads/main~1\n \n-\tINPUT_END\n-\tgit fast-import --force <input\n-'\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --force <input &&\n+\t\t# branch changed, but logged\n+\t\ttest $old_branch != $(git rev-parse --verify main^0) &&\n+\t\ttest $old_branch = $(git rev-parse --verify main@{1}) &&\n \n-test_expect_success 'G: verify pack' '\n-\tverify_packs\n-'\n-\n-test_expect_success 'G: branch changed, but logged' '\n-\ttest $old_branch != $(git rev-parse --verify branch^0) &&\n-\ttest $old_branch = $(git rev-parse --verify branch@{1})\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n '\n \n ###\n@@ -1042,42 +1055,50 @@ test_expect_success 'I: export-pack-edges via stdin' '\n ###\n \n test_expect_success 'J: reset existing branch creates empty commit' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/J\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcreate J\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate J\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch\n+\t\tfrom refs/heads/main\n \n-\treset refs/heads/J\n+\t\treset refs/heads/J\n \n-\tcommit refs/heads/J\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tinitialize J\n-\tCOMMIT\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitialize J\n+\t\tCOMMIT\n \n-\tINPUT_END\n-\tgit fast-import <input\n-'\n-test_expect_success 'J: branch has 1 commit, empty tree' '\n-\ttest 1 = $(git rev-list J | wc -l) &&\n-\ttest 0 = $(git ls-tree J | wc -l)\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# branch has 1 commit, empty tree\n+\t\ttest 1 = $(git rev-list J | wc -l) &&\n+\t\ttest 0 = $(git ls-tree J | wc -l)\n+\t)\n '\n \n test_expect_success 'J: tag must fail on empty branch' '\n-\tcat >input <<-INPUT_END &&\n-\treset refs/heads/J2\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\treset refs/heads/J2\n \n-\ttag wrong_tag\n-\tfrom refs/heads/J2\n-\tdata <<EOF\n-\tTag branch that was reset.\n-\tEOF\n-\tINPUT_END\n-\ttest_must_fail git fast-import <input\n+\t\ttag wrong_tag\n+\t\tfrom refs/heads/J2\n+\t\tdata <<EOF\n+\t\tTag branch that was reset.\n+\t\tEOF\n+\t\tINPUT_END\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n ###\n@@ -1085,29 +1106,32 @@ test_expect_success 'J: tag must fail on empty branch' '\n ###\n \n test_expect_success 'K: reinit branch with from' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/K\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcreate K\n-\tCOMMIT\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate K\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch\n+\t\tfrom refs/heads/main\n \n-\tcommit refs/heads/K\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tredo K\n-\tCOMMIT\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tredo K\n+\t\tCOMMIT\n \n-\tfrom refs/heads/branch^1\n+\t\tfrom refs/heads/main^1\n \n-\tINPUT_END\n-\tgit fast-import <input\n-'\n-test_expect_success 'K: verify K^1 = branch^1' '\n-\ttest $(git rev-parse --verify branch^1) \\\n-\t\t= $(git rev-parse --verify K^1)\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# K^1 = main^1\n+\t\ttest $(git rev-parse --verify main^1) \\\n+\t\t\t= $(git rev-parse --verify K^1)\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558314","messageId":"20261112-kn-fast-import-tests-1-v2-11-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 11/20] t9300: make the date format tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:11Z","receivedAt":"2026-11-12T17:34:11Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the date format tests to\nmake them independent of state from previous tests.\n\nFold the 'E: verify pack' and 'E: verify commit' tests into the test\nperforming the import. As 'fastimport.unpackLimit' is no longer set by\nan earlier test, set it for the import so that a pack is written, and\nverify the pack with an inline loop in place of 'verify_packs()'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 72 ++++++++++++++++++++++++++++++++++----------------\n 1 file changed, 49 insertions(+), 23 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 446cf0c51a..54394c892b 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -828,37 +828,63 @@ test_expect_success 'D: verify file6' '\n ###\n \n test_expect_success 'E: rfc2822 date, --date-format=raw' '\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/branch\n-\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n-\tdata <<COMMIT\n-\tRFC 2822 type date\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n \n-\tfrom refs/heads/branch^0\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n \n-\tINPUT_END\n+\t\tfrom refs/heads/main^0\n \n-\ttest_must_fail git fast-import --date-format=raw <input\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import --date-format=raw <input\n+\t)\n '\n+\n test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n-\tgit fast-import --date-format=rfc2822 <input\n-'\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n \n-test_expect_success 'E: verify pack' '\n-\tverify_packs\n-'\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n \n-test_expect_success 'E: verify commit' '\n-\tcat >expect <<-EOF &&\n-\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n+\t\tfrom refs/heads/main^0\n \n-\tRFC 2822 type date\n-\tEOF\n-\tgit cat-file commit branch | sed 1,2d >actual &&\n-\ttest_cmp expect actual\n+\t\tINPUT_END\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --date-format=rfc2822 <input &&\n+\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n+\n+\t\tRFC 2822 type date\n+\t\tEOF\n+\t\tgit cat-file commit main | sed 1,2d >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558315","messageId":"20261112-kn-fast-import-tests-1-v2-12-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 12/20] t9300: make the pack edges test self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:12Z","receivedAt":"2026-11-12T17:34:12Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the pack-edges tests to make\nthem independent of state from previous tests.\n\nPack edges are only recorded for packs which are kept, so set\n'fastimport.unpackLimit' to 0 for the import.\n\nCreate the repository with 'git init -b main', as the import builds on\n'main' and t9302, where this test ends up, doesn't set\n'GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 90 +++++++++++++++++++++++++++++++-------------------\n 1 file changed, 56 insertions(+), 34 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 54394c892b..5b8550584e 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1030,50 +1030,72 @@ test_expect_success 'H: verify file' '\n ###\n \n test_expect_success 'I: export-pack-edges option forbidden by default' '\n-\techo \"option git export-pack-edges=edges.list\" >input &&\n-\ttest_must_fail git fast-import <input 2>err &&\n-\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"option git export-pack-edges=edges.list\" >input &&\n+\t\ttest_must_fail git fast-import <input 2>err &&\n+\t\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n+\t)\n '\n \n test_expect_success 'I: export-pack-edges' '\n-\ttest_when_finished \"rm edges.list\" &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/export-boundary\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\twe have a border.  its only 40 characters wide.\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init -b main repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n \n-\tfrom refs/heads/branch\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/export-boundary\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\twe have a border.  its only 40 characters wide.\n+\t\tCOMMIT\n \n-\tINPUT_END\n-\tgit fast-import --export-pack-edges=edges.list <input &&\n-\tcat >expect <<-EOF &&\n-\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n-\tEOF\n-\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\ttest_cmp expect actual\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n+\t\t\t--export-pack-edges=edges.list <input &&\n+\n+\t\t# verify edge list\n+\t\tcat >expect <<-EOF &&\n+\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n+\t\tEOF\n+\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'I: export-pack-edges via stdin' '\n-\ttest_when_finished \"rm edges.list\" &&\n-\tcat >input <<-INPUT_END &&\n-\toption git export-pack-edges=edges.list\n-\tcommit refs/heads/export-boundary-2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tone more similar commit\n-\tCOMMIT\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init -b main repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n \n-\tfrom refs/heads/branch\n+\t\tcat >input <<-INPUT_END &&\n+\t\toption git export-pack-edges=edges.list\n+\t\tcommit refs/heads/export-boundary\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tone more similar commit\n+\t\tCOMMIT\n \n-\tINPUT_END\n-\tgit fast-import --allow-unsafe-features <input &&\n-\tcat >expect <<-EOF &&\n-\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary-2)\n-\tEOF\n-\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\ttest_cmp expect actual\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n+\t\t\t--allow-unsafe-features <input &&\n+\t\tcat >expect <<-EOF &&\n+\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n+\t\tEOF\n+\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558316","messageId":"20261112-kn-fast-import-tests-1-v2-13-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 13/20] t9300: make the marks tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:13Z","receivedAt":"2026-11-12T17:34:13Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the marks tests to make them\nindependent of state from previous tests.\n\nSeveral tests import the marks file written by an earlier test. Add a\n'create_marks_file()' function which writes one, with marks for commits\nand tags too, so each test can invoke it in its own repository.\n\n'R: feature import-marks-if-exists' writes a marks file pointing to a\nblob it never stores, relying on an earlier test having written it.\nWrite the blob in the test itself. Also run 'A: export marks with large\nvalues' in its own repository.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 512 +++++++++++++++++++++++++++++++------------------\n 1 file changed, 322 insertions(+), 190 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 5b8550584e..1022299b7d 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -298,59 +298,65 @@ test_expect_success 'A: verify diff' '\n '\n \n test_expect_success 'A: export marks with large values' '\n-\ttest_tick &&\n-\tmt=$(git hash-object --stdin < /dev/null) &&\n-\t>input.blob &&\n-\t>marks.exp &&\n-\t>tree.exp &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tcat >input.commit <<-EOF &&\n-\tcommit refs/heads/verify--dump-marks\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\ttest the sparse array dumping routines with exponentially growing marks\n-\tCOMMIT\n-\tEOF\n+\t\ttest_tick &&\n+\t\tmt=$(git hash-object --stdin < /dev/null) &&\n+\t\t>input.blob &&\n+\t\t>marks.exp &&\n+\t\t>tree.exp &&\n \n-\ti=0 l=4 m=6 n=7 &&\n-\twhile test \"$i\" -lt 27\n-\tdo\n-\t\tcat >>input.blob <<-EOF &&\n-\t\tblob\n-\t\tmark :$l\n-\t\tdata 0\n-\t\tblob\n-\t\tmark :$m\n-\t\tdata 0\n-\t\tblob\n-\t\tmark :$n\n-\t\tdata 0\n+\t\tcat >input.commit <<-EOF &&\n+\t\tcommit refs/heads/verify--dump-marks\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttest the sparse array dumping routines with exponentially growing marks\n+\t\tCOMMIT\n \t\tEOF\n-\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n-\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n-\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n \n-\t\techo \":$l $mt\" >>marks.exp &&\n-\t\techo \":$m $mt\" >>marks.exp &&\n-\t\techo \":$n $mt\" >>marks.exp &&\n+\t\ti=0 l=4 m=6 n=7 &&\n+\t\twhile test \"$i\" -lt 27\n+\t\tdo\n+\t\t\tcat >>input.blob <<-EOF &&\n+\t\t\tblob\n+\t\t\tmark :$l\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$m\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$n\n+\t\t\tdata 0\n+\t\t\tEOF\n+\t\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n \n-\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n-\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n-\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n+\t\t\techo \":$l $mt\" >>marks.exp &&\n+\t\t\techo \":$m $mt\" >>marks.exp &&\n+\t\t\techo \":$n $mt\" >>marks.exp &&\n \n-\t\tl=$(($l + $l)) &&\n-\t\tm=$(($m + $m)) &&\n-\t\tn=$(($l + $n)) &&\n+\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n \n-\t\ti=$((1 + $i)) || return 1\n-\tdone &&\n+\t\t\tl=$(($l + $l)) &&\n+\t\t\tm=$(($m + $m)) &&\n+\t\t\tn=$(($l + $n)) &&\n \n-\tsort tree.exp > tree.exp_s &&\n+\t\t\ti=$((1 + $i)) || return 1\n+\t\tdone &&\n \n-\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n-\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n-\ttest_cmp tree.exp_s tree.out &&\n-\ttest_cmp marks.exp marks.large\n+\t\tsort tree.exp > tree.exp_s &&\n+\n+\t\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n+\t\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n+\t\ttest_cmp tree.exp_s tree.out &&\n+\t\ttest_cmp marks.exp marks.large\n+\t)\n '\n \n ###\n@@ -2681,32 +2687,44 @@ test_expect_success 'R: export-marks feature forbidden by default' '\n '\n \n test_expect_success 'R: export-marks feature results in a marks file being created' '\n-\tcat >input <<-EOF &&\n-\tfeature export-marks=git.marks\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n+\t\tcat >input <<-EOF &&\n+\t\tfeature export-marks=git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n \n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_grep :1 git.marks\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_grep :1 git.marks\n+\t)\n '\n \n test_expect_success 'R: export-marks options can be overridden by commandline options' '\n-\tcat >input <<-\\EOF &&\n-\tfeature export-marks=feature-sub/git.marks\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --allow-unsafe-features \\\n-\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n-\ttest_grep :1 cmdline-sub/other.marks &&\n-\ttest_path_is_missing feature-sub\n+\t\tcat >input <<-\\EOF &&\n+\t\tfeature export-marks=feature-sub/git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\tgit fast-import --allow-unsafe-features \\\n+\t\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n+\t\ttest_grep :1 cmdline-sub/other.marks &&\n+\t\ttest_path_is_missing feature-sub\n+\t)\n '\n \n test_expect_success 'R: --allow-unsafe-features found after a value' '\n@@ -2746,167 +2764,275 @@ test_expect_success 'R: --allow-unsafe-features after a non-option' '\n '\n \n test_expect_success 'R: catch typo in marks file name' '\n-\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n-\techo \"feature import-marks=nonexistent.marks\" |\n-\ttest_must_fail git fast-import --allow-unsafe-features\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n+\t\techo \"feature import-marks=nonexistent.marks\" |\n+\t\ttest_must_fail git fast-import --allow-unsafe-features\n+\t)\n '\n \n test_expect_success 'R: import and output marks can be the same file' '\n-\trm -f io.marks &&\n-\tblob=$(echo hi | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t:1 $blob\n-\t:2 $blob\n-\tEOF\n-\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n-\tblob\n-\tmark :2\n-\tdata 3\n-\thi\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n \n-\tEOF\n-\ttest_cmp expect io.marks\n+\t\tEOF\n+\t\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n '\n \n test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n-\trm -f io.marks &&\n-\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n+\t\trm -f io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t)\n '\n \n test_expect_success 'R: --import-marks-if-exists' '\n-\trm -f io.marks &&\n-\tblob=$(echo hi | git hash-object --stdin) &&\n-\techo \":1 $blob\" >expect &&\n-\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\ttest_cmp expect io.marks\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n '\n \n test_expect_success 'R: feature import-marks-if-exists' '\n-\trm -f io.marks &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit fast-import --export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=not_io.marks\n-\tEOF\n-\ttest_must_be_empty io.marks &&\n+\t\trm -f io.marks &&\n \n-\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks &&\n \n-\techo \":1 $blob\" >io.marks &&\n-\techo \":1 $blob\" >expect &&\n-\techo \":2 $blob\" >>expect &&\n+\t\tblob=$(echo hi | git hash-object -w --stdin) &&\n \n-\tgit fast-import --export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=io.marks\n-\tblob\n-\tmark :2\n-\tdata 3\n-\thi\n+\t\techo \":1 $blob\" >io.marks &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\techo \":2 $blob\" >>expect &&\n \n-\tEOF\n-\ttest_cmp expect io.marks &&\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n \n-\techo \":3 $blob\" >>expect &&\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n \n-\tgit fast-import --import-marks=io.marks \\\n-\t\t\t--export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=not_io.marks\n-\tblob\n-\tmark :3\n-\tdata 3\n-\thi\n+\t\techo \":3 $blob\" >>expect &&\n \n-\tEOF\n-\ttest_cmp expect io.marks &&\n+\t\tgit fast-import --import-marks=io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tblob\n+\t\tmark :3\n+\t\tdata 3\n+\t\thi\n \n-\tgit fast-import --import-marks-if-exists=not_io.marks \\\n-\t\t\t--export-marks=io.marks \\\n-\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\tfeature import-marks-if-exists=io.marks\n-\tEOF\n-\ttest_must_be_empty io.marks\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n+\n+\t\tgit fast-import --import-marks-if-exists=not_io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks\n+\t)\n '\n \n-test_expect_success 'R: import to output marks works without any content' '\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=marks.out\n-\tfeature export-marks=marks.new\n-\tEOF\n+create_marks_file () {\n+\tgit fast-import --export-marks=\"$1\" <<-EOF\n+\tblob\n+\tmark :1\n+\tdata 4\n+\tone\n \n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_cmp marks.out marks.new\n+\tblob\n+\tmark :2\n+\tdata 4\n+\ttwo\n+\n+\tblob\n+\tmark :3\n+\tdata 6\n+\tthree\n+\n+\tblob\n+\tmark :4\n+\tdata 5\n+\tfour\n+\n+\tcommit refs/heads/marks\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit with a mark\n+\tCOMMIT\n+\tM 100644 :1 one\n+\n+\ttag marks-tag\n+\tmark :6\n+\tfrom :5\n+\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<TAG\n+\ttag with a mark\n+\tTAG\n+\n+\tEOF\n+}\n+\n+test_expect_success 'R: import to output marks works without any content' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=marks.out\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n '\n \n test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=nonexistent.marks\n-\tfeature export-marks=marks.new\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n-\ttest_cmp marks.out marks.new\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n '\n \n-\n test_expect_success 'R: multiple --import-marks= should be honoured' '\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=nonexistent.marks\n-\tfeature export-marks=combined.marks\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\thead -n2 marks.out > one.marks &&\n-\ttail -n +3 marks.out > two.marks &&\n-\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n-\t\t--allow-unsafe-features <input &&\n-\ttest_cmp marks.out combined.marks\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=combined.marks\n+\t\tEOF\n+\n+\t\thead -n2 marks.out >one.marks &&\n+\t\ttail -n +3 marks.out >two.marks &&\n+\t\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n+\t\t\t--allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out combined.marks\n+\t)\n '\n \n test_expect_success 'R: feature relative-marks should be honoured' '\n-\tcat >input <<-EOF &&\n-\tfeature relative-marks\n-\tfeature import-marks=relative.in\n-\tfeature export-marks=relative.out\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\tmkdir -p .git/info/fast-import/ &&\n-\tcp marks.new .git/info/fast-import/relative.in &&\n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_cmp marks.new .git/info/fast-import/relative.out\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature export-marks=relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out .git/info/fast-import/relative.out\n+\t)\n '\n \n test_expect_success 'R: feature no-relative-marks should be honoured' '\n-\tcat >input <<-EOF &&\n-\tfeature relative-marks\n-\tfeature import-marks=relative.in\n-\tfeature no-relative-marks\n-\tfeature export-marks=non-relative.out\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n \n-\tgit fast-import --allow-unsafe-features <input &&\n-\ttest_cmp marks.new non-relative.out\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature no-relative-marks\n+\t\tfeature export-marks=non-relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out non-relative.out\n+\t)\n '\n \n+\n test_expect_success 'R: feature ls supported' '\n \techo \"feature ls\" |\n \tgit fast-import\n@@ -3252,18 +3378,24 @@ test_expect_success 'R: ignore non-git options' '\n '\n \n test_expect_success 'R: corrupt lines do not mess marks file' '\n-\trm -f io.marks &&\n-\tblob=$(echo hi | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t:3 $ZERO_OID\n-\t:1 $blob\n-\t:2 $blob\n-\tEOF\n-\tcp expect io.marks &&\n-\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\ttest_cmp expect io.marks\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:3 $ZERO_OID\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tcp expect io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n '\n \n ##\n\n-- \n2.56.GIT\n\n\n"},{"id":"558317","messageId":"20261112-kn-fast-import-tests-1-v2-14-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 14/20] t9300: make the series Y tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:14Z","receivedAt":"2026-11-12T17:34:14Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the 'series Y' tests to make\nthem independent of state from previous tests.\n\nThe 'Y: setup' test only fills the OID cache for 'Y: rewrite\nsubmodules', so merge it into that test. Also clean up the\nrepositories created by the tests.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 40 +++++++++++++++++++++++++++-------------\n 1 file changed, 27 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 1022299b7d..7b755d8de1 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -4579,27 +4579,35 @@ cat >Y-marks <<\\Y_INPUT_END\n :4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n Y_INPUT_END\n \n-test_expect_success 'Y: setup' '\n-\ttest_oid_cache <<-EOF\n-\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n-\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n-\tEOF\n-'\n-\n test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n-\techo \"feature rewrite-submodules-to=sub:sub2-marks\" >input &&\n-\ttest_must_fail git fast-import <input 2>err &&\n-\ttest_grep \"feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features\" err\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" >input &&\n+\t\ttest_must_fail git fast-import <input 2>err &&\n+\t\ttest_grep \"feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features\" err\n+\t)\n '\n \n test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n-\techo \"feature rewrite-submodules-from=sub:../Y-marks\" >input &&\n-\ttest_must_fail git fast-import <input 2>err &&\n-\ttest_grep \"feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features\" err\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" >input &&\n+\t\ttest_must_fail git fast-import <input 2>err &&\n+\t\ttest_grep \"feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features\" err\n+\t)\n '\n \n test_expect_success 'Y: rewrite submodules' '\n \ttest_when_finished \"rm -rf main1\" &&\n+\ttest_oid_cache <<-EOF &&\n+\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n+\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n+\tEOF\n+\n \tgit init main1 &&\n \t(\n \t\tcd main1 &&\n@@ -4619,6 +4627,7 @@ test_expect_success 'Y: reference pending tag or commit' '\n \tpending_tag sha256:85edc5eac315bc680677b2fc71622bd77476f057eb8dc8ed6a497803a24f1f46\n \tEOF\n \n+\ttest_when_finished \"rm -rf reference-pending\" &&\n \tgit init reference-pending &&\n \t(\n \t\tcd reference-pending &&\n@@ -4656,6 +4665,11 @@ test_expect_success 'Y: reference pending tag or commit' '\n \n test_expect_success 'Y: rewrite submodules via stdin' '\n \ttest_when_finished \"rm -rf main1\" &&\n+\ttest_oid_cache <<-EOF &&\n+\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n+\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n+\tEOF\n+\n \tgit init main1 &&\n \t(\n \t\tcd main1 &&\n\n-- \n2.56.GIT\n\n\n"},{"id":"558318","messageId":"20261112-kn-fast-import-tests-1-v2-15-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 15/20] t9300: make the cat-blob tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:15Z","receivedAt":"2026-11-12T17:34:15Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the cat-blog tests to make\nthem independent of state from previous tests.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 428 ++++++++++++++++++++++++++++---------------------\n 1 file changed, 242 insertions(+), 186 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 7b755d8de1..0dc71648ca 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -3048,87 +3048,117 @@ test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n '\n \n test_expect_success !MINGW 'R: print old blob' '\n-\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 11\n-\tyes it can\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\techo \"cat-blob $blob\" |\n-\tgit fast-import --cat-blob-fd=6 6>actual &&\n-\ttest_cmp expect actual\n+\t\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 11\n+\t\tyes it can\n+\n+\t\tEOF\n+\t\techo \"cat-blob $blob\" |\n+\t\tgit fast-import --cat-blob-fd=6 6>actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n-\techo hello >greeting &&\n-\tblob=$(git hash-object -w greeting) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 6\n-\thello\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n-\tcat-blob $blob\n-\tEOF\n-\ttest_cmp expect actual.3 &&\n-\ttest_must_be_empty actual.1 &&\n-\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n-\toption cat-blob-fd=3\n-\tcat-blob $blob\n-\tEOF\n-\ttest_must_be_empty actual.3 &&\n-\ttest_cmp expect actual.1\n+\t\techo hello >greeting &&\n+\t\tblob=$(git hash-object -w greeting) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 6\n+\t\thello\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual.3 &&\n+\t\ttest_must_be_empty actual.1 &&\n+\t\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n+\t\toption cat-blob-fd=3\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_must_be_empty actual.3 &&\n+\t\ttest_cmp expect actual.1\n+\t)\n '\n \n test_expect_success !MINGW 'R: print mark for new blob' '\n-\techo \"effluentish\" | git hash-object --stdin >expect &&\n-\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata <<BLOB_END\n-\teffluentish\n-\tBLOB_END\n-\tget-mark :1\n-\tEOF\n-\ttest_cmp expect actual\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"effluentish\" | git hash-object --stdin >expect &&\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\teffluentish\n+\t\tBLOB_END\n+\t\tget-mark :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success !MINGW 'R: print new blob' '\n-\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 12\n-\tyep yep yep\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\tblob\n-\tmark :1\n-\tdata <<BLOB_END\n-\tyep yep yep\n-\tBLOB_END\n-\tcat-blob :1\n-\tEOF\n-\ttest_cmp expect actual\n+\t\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 12\n+\t\tyep yep yep\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\tyep yep yep\n+\t\tBLOB_END\n+\t\tcat-blob :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success !MINGW 'R: print new blob by sha1' '\n-\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n-\tcat >expect <<-EOF &&\n-\t${blob} blob 25\n-\ta new blob named by sha1\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n-\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n-\tblob\n-\tdata <<BLOB_END\n-\ta new blob named by sha1\n-\tBLOB_END\n-\tcat-blob $blob\n-\tEOF\n-\ttest_cmp expect actual\n+\t\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 25\n+\t\ta new blob named by sha1\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n+\t\tblob\n+\t\tdata <<BLOB_END\n+\t\ta new blob named by sha1\n+\t\tBLOB_END\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n-test_expect_success 'setup: big file' '\n+setup_big_file () {\n \t(\n \t\techo \"the quick brown fox jumps over the lazy dog\" >big &&\n \t\tfor i in 1 2 3\n@@ -3138,153 +3168,179 @@ test_expect_success 'setup: big file' '\n \t\t\texit\n \t\tdone\n \t)\n-'\n+}\n \n test_expect_success 'R: print two blobs to stdout' '\n-\tblob1=$(git hash-object big) &&\n-\tblob1_len=$(wc -c <big) &&\n-\tblob2=$(echo hello | git hash-object --stdin) &&\n-\t{\n-\t\techo ${blob1} blob $blob1_len &&\n-\t\tcat big &&\n-\t\tcat <<-EOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\t\t${blob2} blob 6\n-\t\thello\n+\t\tsetup_big_file &&\n+\t\tblob1=$(git hash-object big) &&\n+\t\tblob1_len=$(wc -c <big) &&\n+\t\tblob2=$(echo hello | git hash-object --stdin) &&\n+\t\t{\n+\t\t\techo ${blob1} blob $blob1_len &&\n+\t\t\tcat big &&\n+\t\t\tcat <<-EOF\n \n-\t\tEOF\n-\t} >expect &&\n-\t{\n-\t\tcat <<-\\END_PART1 &&\n-\t\t\tblob\n-\t\t\tmark :1\n-\t\t\tdata <<data_end\n-\t\tEND_PART1\n-\t\tcat big &&\n-\t\tcat <<-\\EOF\n-\t\t\tdata_end\n-\t\t\tblob\n-\t\t\tmark :2\n-\t\t\tdata <<data_end\n+\t\t\t${blob2} blob 6\n \t\t\thello\n-\t\t\tdata_end\n-\t\t\tcat-blob :1\n-\t\t\tcat-blob :2\n-\t\tEOF\n-\t} |\n-\tgit fast-import >actual &&\n-\ttest_cmp expect actual\n+\n+\t\t\tEOF\n+\t\t} >expect &&\n+\t\t{\n+\t\t\tcat <<-\\END_PART1 &&\n+\t\t\t\tblob\n+\t\t\t\tmark :1\n+\t\t\t\tdata <<data_end\n+\t\t\tEND_PART1\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF\n+\t\t\t\tdata_end\n+\t\t\t\tblob\n+\t\t\t\tmark :2\n+\t\t\t\tdata <<data_end\n+\t\t\t\thello\n+\t\t\t\tdata_end\n+\t\t\t\tcat-blob :1\n+\t\t\t\tcat-blob :2\n+\t\t\tEOF\n+\t\t} |\n+\t\tgit fast-import >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success PIPE 'R: copy using cat-file' '\n-\texpect_id=$(git hash-object big) &&\n-\texpect_len=$(wc -c <big) &&\n-\techo $expect_id blob $expect_len >expect.response &&\n-\n-\trm -f blobs &&\n-\n-\tmkfifo blobs &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n-\t\tcat <<-\\EOF &&\n-\t\tfeature cat-blob\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB\n-\t\tEOF\n-\t\tcat big &&\n-\t\tcat <<-\\EOF &&\n-\t\tBLOB\n-\t\tcat-blob :1\n-\t\tEOF\n+\t\tcd repo &&\n \n-\t\tread blob_id type size <&3 &&\n-\t\techo \"$blob_id $type $size\" >response &&\n-\t\ttest_copy_bytes $size >blob <&3 &&\n-\t\tread newline <&3 &&\n+\t\tsetup_big_file &&\n+\t\texpect_id=$(git hash-object big) &&\n+\t\texpect_len=$(wc -c <big) &&\n+\t\techo $expect_id blob $expect_len >expect.response &&\n \n-\t\tcat <<-EOF &&\n-\t\tcommit refs/heads/copied\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcopy big file as file3\n-\t\tCOMMIT\n-\t\tM 644 inline file3\n-\t\tdata <<BLOB\n-\t\tEOF\n-\t\tcat blob &&\n-\t\techo BLOB\n-\t) 3<blobs |\n-\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\tgit show copied:file3 >actual &&\n-\ttest_cmp expect.response response &&\n-\ttest_cmp big actual\n+\t\trm -f blobs &&\n+\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tBLOB\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\techo \"$blob_id $type $size\" >response &&\n+\t\t\ttest_copy_bytes $size >blob <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\tcat <<-EOF &&\n+\t\t\tcommit refs/heads/copied\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tcopy big file as file3\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline file3\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat blob &&\n+\t\t\techo BLOB\n+\t\t) 3<blobs |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\tgit show copied:file3 >actual &&\n+\t\ttest_cmp expect.response response &&\n+\t\ttest_cmp big actual\n+\t)\n '\n \n test_expect_success PIPE 'R: print blob mid-commit' '\n-\trm -f blobs &&\n-\techo \"A blob from _before_ the commit.\" >expect &&\n-\tmkfifo blobs &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\texec 3<blobs &&\n-\t\tcat <<-EOF &&\n-\t\tfeature cat-blob\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB\n-\t\tA blob from _before_ the commit.\n-\t\tBLOB\n-\t\tcommit refs/heads/temporary\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tEmpty commit\n-\t\tCOMMIT\n-\t\tcat-blob :1\n-\t\tEOF\n+\t\tcd repo &&\n \n-\t\tread blob_id type size <&3 &&\n-\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\tread newline <&3 &&\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _before_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _before_ the commit.\n+\t\t\tBLOB\n+\t\t\tcommit refs/heads/temporary\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n \n-\t\techo\n-\t) |\n-\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\ttest_cmp expect actual\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success PIPE 'R: print staged blob within commit' '\n-\trm -f blobs &&\n-\techo \"A blob from _within_ the commit.\" >expect &&\n-\tmkfifo blobs &&\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n \t(\n-\t\texec 3<blobs &&\n-\t\tcat <<-EOF &&\n-\t\tfeature cat-blob\n-\t\tcommit refs/heads/within\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tEmpty commit\n-\t\tCOMMIT\n-\t\tM 644 inline within\n-\t\tdata <<BLOB\n-\t\tA blob from _within_ the commit.\n-\t\tBLOB\n-\t\tEOF\n+\t\tcd repo &&\n \n-\t\tto_get=$(\n-\t\t\techo \"A blob from _within_ the commit.\" |\n-\t\t\tgit hash-object --stdin\n-\t\t) &&\n-\t\techo \"cat-blob $to_get\" &&\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _within_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tcommit refs/heads/within\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline within\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _within_ the commit.\n+\t\t\tBLOB\n+\t\t\tEOF\n \n-\t\tread blob_id type size <&3 &&\n-\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\tread newline <&3 &&\n+\t\t\tto_get=$(\n+\t\t\t\techo \"A blob from _within_ the commit.\" |\n+\t\t\t\tgit hash-object --stdin\n+\t\t\t) &&\n+\t\t\techo \"cat-blob $to_get\" &&\n \n-\t\techo deleteall\n-\t) |\n-\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\ttest_cmp expect actual\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo deleteall\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'R: quiet option results in no stats being output' '\n\n-- \n2.56.GIT\n\n\n"},{"id":"558319","messageId":"20261112-kn-fast-import-tests-1-v2-16-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 16/20] t9300: make the feature and option tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:16Z","receivedAt":"2026-11-12T17:34:16Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series R' which\ncheck the 'feature' command and the command line options to make them\nindependent of state from previous tests.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 260 +++++++++++++++++++++++++++++++++++--------------\n 1 file changed, 187 insertions(+), 73 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 0dc71648ca..5f84c66ac4 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2636,54 +2636,90 @@ test_expect_success 'Q: deny note on empty branch' '\n ###\n \n test_expect_success 'R: abort on unsupported feature' '\n-\tcat >input <<-EOF &&\n-\tfeature no-such-feature-exists\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\tfeature no-such-feature-exists\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: supported feature is accepted' '\n-\tcat >input <<-EOF &&\n-\tfeature date-format=now\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n '\n \n test_expect_success 'R: abort on receiving feature after data command' '\n-\tcat >input <<-EOF &&\n-\tblob\n-\tdata 3\n-\thi\n-\tfeature date-format=now\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: import-marks features forbidden by default' '\n-\t>git.marks &&\n-\techo \"feature import-marks=git.marks\" >input &&\n-\ttest_must_fail git fast-import <input &&\n-\techo \"feature import-marks-if-exists=git.marks\" >input &&\n-\ttest_must_fail git fast-import <input\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t>git.marks &&\n+\t\techo \"feature import-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input &&\n+\t\techo \"feature import-marks-if-exists=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: only one import-marks feature allowed per stream' '\n-\t>git.marks &&\n-\t>git2.marks &&\n-\tcat >input <<-EOF &&\n-\tfeature import-marks=git.marks\n-\tfeature import-marks=git2.marks\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import --allow-unsafe-features <input\n+\t\t>git.marks &&\n+\t\t>git2.marks &&\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=git.marks\n+\t\tfeature import-marks=git2.marks\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --allow-unsafe-features <input\n+\t)\n '\n \n test_expect_success 'R: export-marks feature forbidden by default' '\n-\techo \"feature export-marks=git.marks\" >input &&\n-\ttest_must_fail git fast-import <input\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature export-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: export-marks feature results in a marks file being created' '\n@@ -2728,39 +2764,69 @@ test_expect_success 'R: export-marks options can be overridden by commandline op\n '\n \n test_expect_success 'R: --allow-unsafe-features found after a value' '\n-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\tgit fast-import --allow-unsafe-features <input &&\n-\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n-\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n-\tgit fast-import --date-format raw --allow-unsafe-features <input\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n+\t\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n+\t\tgit fast-import --date-format raw --allow-unsafe-features <input\n+\t)\n '\n \n test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n-\tgit fast-import --allow-unsafe <input\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n+\t\tgit fast-import --allow-unsafe <input\n+\t)\n '\n \n test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n-\t\tgit fast-import --allow-unsafe <input 2>err &&\n-\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n+\t\t\tgit fast-import --allow-unsafe <input 2>err &&\n+\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\t)\n '\n \n test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n-\t\tgit fast-import --quiet --export-pack \\\n-\t\t--allow-unsafe-features <input 2>err &&\n-\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n+\t\t\tgit fast-import --quiet --export-pack \\\n+\t\t\t--allow-unsafe-features <input 2>err &&\n+\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\t)\n '\n \n test_expect_success 'R: --allow-unsafe-features after a non-option' '\n-\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\ttest_must_fail git fast-import --depth 5 extra \\\n-\t\t--allow-unsafe-features <input 2>err &&\n-\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\ttest_must_fail git fast-import --depth 5 extra \\\n+\t\t\t--allow-unsafe-features <input 2>err &&\n+\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\t)\n '\n \n test_expect_success 'R: catch typo in marks file name' '\n@@ -3034,17 +3100,35 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '\n \n \n test_expect_success 'R: feature ls supported' '\n-\techo \"feature ls\" |\n-\tgit fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature ls\" |\n+\t\tgit fast-import\n+\t)\n '\n \n test_expect_success 'R: feature cat-blob supported' '\n-\techo \"feature cat-blob\" |\n-\tgit fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature cat-blob\" |\n+\t\tgit fast-import\n+\t)\n '\n \n test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n-\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n+\t)\n '\n \n test_expect_success !MINGW 'R: print old blob' '\n@@ -3399,38 +3483,68 @@ test_expect_success 'R: terminating \"done\" within commit' '\n '\n \n test_expect_success 'R: die on unknown option' '\n-\tcat >input <<-EOF &&\n-\toption git non-existing-option\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\ttest_must_fail git fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\toption git non-existing-option\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n '\n \n test_expect_success 'R: unknown commandline options are rejected' '\\\n-\ttest_must_fail git fast-import --non-existing-option < /dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --non-existing-option < /dev/null\n+\t)\n '\n \n test_expect_success 'R: feature-only names are rejected on the command line' '\n-\tfor opt in --alias --get-mark --ls --notes\n-\tdo\n-\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n-\tdone\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfor opt in --alias --get-mark --ls --notes\n+\t\tdo\n+\t\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n+\t\tdone\n+\t)\n '\n \n test_expect_success 'R: die on invalid option argument' '\n-\techo \"option git active-branches=-5\" |\n-\ttest_must_fail git fast-import &&\n-\techo \"option git depth=\" |\n-\ttest_must_fail git fast-import &&\n-\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"option git active-branches=-5\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\techo \"option git depth=\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n+\t)\n '\n \n test_expect_success 'R: ignore non-git options' '\n-\tcat >input <<-EOF &&\n-\toption non-existing-vcs non-existing-option\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tgit fast-import <input\n+\t\tcat >input <<-EOF &&\n+\t\toption non-existing-vcs non-existing-option\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n '\n \n test_expect_success 'R: corrupt lines do not mess marks file' '\n\n-- \n2.56.GIT\n\n\n"},{"id":"558320","messageId":"20261112-kn-fast-import-tests-1-v2-17-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 17/20] t9300: make the stream tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:17Z","receivedAt":"2026-11-12T17:34:17Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series R' which\ncheck empty and truncated streams, the 'quiet' option and the 'done'\nfeature to make them independent of state from previous tests.\n\n'empty stream succeeds' no longer needs to configure\n'fastimport.unpackLimit', as that was moved to the first test needing it\nby an earlier commit.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 154 ++++++++++++++++++++++++++++++++-----------------\n 1 file changed, 101 insertions(+), 53 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 5f84c66ac4..45720ed003 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -38,11 +38,23 @@ echo \"$@\"'\n ###\n \n test_expect_success 'empty stream succeeds' '\n-\tgit fast-import </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import </dev/null\n+\t)\n '\n \n test_expect_success 'truncated stream complains' '\n-\techo \"tag foo\" | test_must_fail git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"tag foo\" | test_must_fail git fast-import\n+\t)\n '\n \n test_expect_success 'A: create pack from stdin' '\n@@ -3428,58 +3440,82 @@ test_expect_success PIPE 'R: print staged blob within commit' '\n '\n \n test_expect_success 'R: quiet option results in no stats being output' '\n-\tcat >input <<-EOF &&\n-\toption git quiet\n-\tblob\n-\tdata 3\n-\thi\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tEOF\n+\t\tcat >input <<-EOF &&\n+\t\toption git quiet\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n \n-\tgit fast-import 2>output <input &&\n-\ttest_must_be_empty output\n+\t\tEOF\n+\n+\t\tgit fast-import 2>output <input &&\n+\t\ttest_must_be_empty output\n+\t)\n '\n \n test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n-\techo feature done | test_must_fail git fast-import &&\n-\ttest_must_fail git fast-import --done </dev/null\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo feature done | test_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --done </dev/null\n+\t)\n '\n \n test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n-\tgit fast-import <<-\\EOF &&\n-\tfeature done\n-\tdone\n-\ttrailing gibberish\n-\tEOF\n-\tgit fast-import <<-\\EOF\n-\tdone\n-\tmore trailing gibberish\n-\tEOF\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import <<-\\EOF &&\n+\t\tfeature done\n+\t\tdone\n+\t\ttrailing gibberish\n+\t\tEOF\n+\t\tgit fast-import <<-\\EOF\n+\t\tdone\n+\t\tmore trailing gibberish\n+\t\tEOF\n+\t)\n '\n \n test_expect_success 'R: terminating \"done\" within commit' '\n-\tcat >expect <<-\\EOF &&\n-\tOBJID\n-\t:000000 100644 OBJID OBJID A\thello.c\n-\t:000000 100644 OBJID OBJID A\thello2.c\n-\tEOF\n-\tgit fast-import <<-EOF &&\n-\tcommit refs/heads/done-ends\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<EOT\n-\tCommit terminated by \"done\" command\n-\tEOT\n-\tM 100644 inline hello.c\n-\tdata <<EOT\n-\tHello, world.\n-\tEOT\n-\tC hello.c hello2.c\n-\tdone\n-\tEOF\n-\tgit rev-list done-ends |\n-\tgit diff-tree -r --stdin --root --always |\n-\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n-\ttest_cmp expect actual\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >expect <<-\\EOF &&\n+\t\tOBJID\n+\t\t:000000 100644 OBJID OBJID A\thello.c\n+\t\t:000000 100644 OBJID OBJID A\thello2.c\n+\t\tEOF\n+\t\tgit fast-import <<-EOF &&\n+\t\tcommit refs/heads/done-ends\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<EOT\n+\t\tCommit terminated by \"done\" command\n+\t\tEOT\n+\t\tM 100644 inline hello.c\n+\t\tdata <<EOT\n+\t\tHello, world.\n+\t\tEOT\n+\t\tC hello.c hello2.c\n+\t\tdone\n+\t\tEOF\n+\t\tgit rev-list done-ends |\n+\t\tgit diff-tree -r --stdin --root --always |\n+\t\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n '\n \n test_expect_success 'R: die on unknown option' '\n@@ -3615,19 +3651,31 @@ test_expect_success 'R: blob bigger than threshold' '\n '\n \n test_expect_success 'R: --git-completion-helper does not read from stdin' '\n-\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n-\techo garbage | git fast-import --git-completion-helper >out &&\n-\ttest_grep -e \"--date-format=\" out &&\n-\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n-\ttest_cmp before after\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n+\t\techo garbage | git fast-import --git-completion-helper >out &&\n+\t\ttest_grep -e \"--date-format=\" out &&\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n+\t\ttest_cmp before after\n+\t)\n '\n \n test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n-\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n-\techo garbage | git fast-import --git-completion-helper-all >all &&\n-\ttest_grep -e \"--allow-unsafe-features\" all &&\n-\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n-\ttest_cmp before after\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n+\t\techo garbage | git fast-import --git-completion-helper-all >all &&\n+\t\ttest_grep -e \"--allow-unsafe-features\" all &&\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n+\t\ttest_cmp before after\n+\t)\n '\n \n ###\n\n-- \n2.56.GIT\n\n\n"},{"id":"558321","messageId":"20261112-kn-fast-import-tests-1-v2-18-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 18/20] t9300: make the get-mark and encoding tests self-contained","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:18Z","receivedAt":"2026-11-12T17:34:18Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Similar to the previous commits, modify the tests in 'series W' and 'X:\nhandling encoding' to make them independent of state from previous\ntests.\n\nThe 'W' tests read the 'W-input' file written at the top level of the\nscript, which is not in the new repository. Turn it into a 'w_input()'\nfunction which prints the stream.\n\n'X: replace ref that becomes useless is removed' changes its working\ndirectory and doesn't change back, so the tests after it, run in that\nrepository. Move the 'cd' into the subshell, and cleanup when the test\ncompletes.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9300-fast-import.sh | 81 +++++++++++++++++++++++++++++++++++---------------\n 1 file changed, 57 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 45720ed003..07bd48d2e8 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -4626,7 +4626,8 @@ test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n ### series W (get-mark and empty orphan commits)\n ###\n \n-cat >>W-input <<-W_INPUT_END\n+w_input () {\n+\tcat <<-W_INPUT_END\n \tcommit refs/heads/W-branch\n \tmark :1\n \tauthor Full Name <user@company.tld> 1000000000 +0100\n@@ -4635,28 +4636,53 @@ cat >>W-input <<-W_INPUT_END\n \tIntentionally empty commit\n \tLFsget-mark :1\n \tW_INPUT_END\n+}\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n-\tsed -e s/LFs// W-input | tr L \"\\n\" | git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs// | tr L \"\\n\" | git fast-import\n+\t)\n '\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n-\tsed -e s/LFs/L/ W-input | tr L \"\\n\" | git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs/L/ | tr L \"\\n\" | git fast-import\n+\t)\n '\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n-\t# Technically, this should fail as it has too many linefeeds\n-\t# according to the grammar in fast-import.txt.  But, for whatever\n-\t# reason, it works.  Since using the correct number of newlines\n-\t# does not work with older (pre-2.22) versions of git, allow apps\n-\t# that used this second-newline workaround to keep working by\n-\t# checking it with this test...\n-\tsed -e s/LFs/LL/ W-input | tr L \"\\n\" | git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# Technically, this should fail as it has too many linefeeds\n+\t\t# according to the grammar in fast-import.txt.  But, for whatever\n+\t\t# reason, it works.  Since using the correct number of newlines\n+\t\t# does not work with older (pre-2.22) versions of git, allow apps\n+\t\t# that used this second-newline workaround to keep working by\n+\t\t# checking it with this test...\n+\t\tw_input | sed -e s/LFs/LL/ | tr L \"\\n\" | git fast-import\n+\t)\n '\n \n test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n-\t# ...but do NOT allow more empty lines than that (see previous test).\n-\tsed -e s/LFs/LLL/ W-input | tr L \"\\n\" | test_must_fail git fast-import\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# ...but do NOT allow more empty lines than that (see previous test).\n+\t\tw_input | sed -e s/LFs/LLL/ | tr L \"\\n\" | test_must_fail git fast-import\n+\t)\n '\n \n ###\n@@ -4664,25 +4690,32 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous thi\n ###\n \n test_expect_success ICONV 'X: handling encoding' '\n-\ttest_tick &&\n-\tcat >input <<-INPUT_END &&\n-\tcommit refs/heads/encoding\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tencoding iso-8859-7\n-\tdata <<COMMIT\n-\tINPUT_END\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n \n-\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/encoding\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tencoding iso-8859-7\n+\t\tdata <<COMMIT\n+\t\tINPUT_END\n \n-\tgit fast-import <input &&\n-\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n-\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n+\t\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n+\n+\t\tgit fast-import <input &&\n+\t\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n+\t\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n+\t)\n '\n \n test_expect_success 'X: replace ref that becomes useless is removed' '\n+\ttest_when_finished \"rm -rf testrepo\" &&\n \tgit init -qb main testrepo &&\n-\tcd testrepo &&\n \t(\n+\t\tcd testrepo &&\n \t\ttest_commit test &&\n \n \t\ttest_commit msg somename content &&\n\n-- \n2.56.GIT\n\n\n"},{"id":"558322","messageId":"20261112-kn-fast-import-tests-1-v2-19-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 19/20] t9300: move self-contained tests into dedicated files","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:19Z","receivedAt":"2026-11-12T17:34:19Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The previous commits worked on making most of the tests within t9300\nindependent from each other. Now we can move them, as they are, to\nother files based on what they exercise. Create some new test files:\n\n  - t9307-fast-import-validation\n  - t9308-fast-import-stream\n  - t9309-fast-import-checkpoint\n  - t9310-fast-import-submodule\n  - t9311-fast-import-refs\n\nand move the others to existing test files:\n\n  - t9301-fast-import-notes\n  - t9304-fast-import-marks\n\nRegister the new test files in t/meson.build.\n\nThe series 'A', 'C', 'D', 'H', 'L', 'M', 'N' and 'U' stay in t9300, as\nthey still depend on each other. The tests are moved without changes,\nwhich can be checked with 'git show --color-moved'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/meson.build                     |    5 +\n t/t9300-fast-import.sh            | 3730 -------------------------------------\n t/t9301-fast-import-notes.sh      |  400 ++++\n t/t9304-fast-import-marks.sh      |  393 ++++\n t/t9307-fast-import-validation.sh | 1262 +++++++++++++\n t/t9308-fast-import-stream.sh     |  890 +++++++++\n t/t9309-fast-import-checkpoint.sh |  188 ++\n t/t9310-fast-import-submodule.sh  |  385 ++++\n t/t9311-fast-import-refs.sh       |  194 ++\n 9 files changed, 3717 insertions(+), 3730 deletions(-)\n\ndiff --git a/t/meson.build b/t/meson.build\nindex 1cf1d95f70..15feb9c33f 100644\n--- a/t/meson.build\n+++ b/t/meson.build\n@@ -1086,6 +1086,11 @@ integration_tests = [\n   't9304-fast-import-marks.sh',\n   't9305-fast-import-signatures.sh',\n   't9306-fast-import-signed-tags.sh',\n+  't9307-fast-import-validation.sh',\n+  't9308-fast-import-stream.sh',\n+  't9309-fast-import-checkpoint.sh',\n+  't9310-fast-import-submodule.sh',\n+  't9311-fast-import-refs.sh',\n   't9350-fast-export.sh',\n   't9351-fast-export-anonymize.sh',\n   't9400-git-cvsserver-server.sh',\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 07bd48d2e8..32846bfe79 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -37,26 +37,6 @@ echo \"$@\"'\n ### series A\n ###\n \n-test_expect_success 'empty stream succeeds' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit fast-import </dev/null\n-\t)\n-'\n-\n-test_expect_success 'truncated stream complains' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"tag foo\" | test_must_fail git fast-import\n-\t)\n-'\n-\n test_expect_success 'A: create pack from stdin' '\n \tgit config fastimport.unpackLimit 0 &&\n \ttest_tick &&\n@@ -309,421 +289,6 @@ test_expect_success 'A: verify diff' '\n \t    = $(git rev-parse --verify verify--import-marks:copy-of-file2)\n '\n \n-test_expect_success 'A: export marks with large values' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_tick &&\n-\t\tmt=$(git hash-object --stdin < /dev/null) &&\n-\t\t>input.blob &&\n-\t\t>marks.exp &&\n-\t\t>tree.exp &&\n-\n-\t\tcat >input.commit <<-EOF &&\n-\t\tcommit refs/heads/verify--dump-marks\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\ttest the sparse array dumping routines with exponentially growing marks\n-\t\tCOMMIT\n-\t\tEOF\n-\n-\t\ti=0 l=4 m=6 n=7 &&\n-\t\twhile test \"$i\" -lt 27\n-\t\tdo\n-\t\t\tcat >>input.blob <<-EOF &&\n-\t\t\tblob\n-\t\t\tmark :$l\n-\t\t\tdata 0\n-\t\t\tblob\n-\t\t\tmark :$m\n-\t\t\tdata 0\n-\t\t\tblob\n-\t\t\tmark :$n\n-\t\t\tdata 0\n-\t\t\tEOF\n-\t\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n-\t\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n-\t\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n-\n-\t\t\techo \":$l $mt\" >>marks.exp &&\n-\t\t\techo \":$m $mt\" >>marks.exp &&\n-\t\t\techo \":$n $mt\" >>marks.exp &&\n-\n-\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n-\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n-\t\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n-\n-\t\t\tl=$(($l + $l)) &&\n-\t\t\tm=$(($m + $m)) &&\n-\t\t\tn=$(($l + $n)) &&\n-\n-\t\t\ti=$((1 + $i)) || return 1\n-\t\tdone &&\n-\n-\t\tsort tree.exp > tree.exp_s &&\n-\n-\t\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n-\t\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n-\t\ttest_cmp tree.exp_s tree.out &&\n-\t\ttest_cmp marks.exp marks.large\n-\t)\n-'\n-\n-###\n-### series B\n-###\n-\n-test_expect_success 'B: fail on invalid blob sha1' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit base &&\n-\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/branch\n-\t\tmark :1\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcorrupt\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\t\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit new &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit TEMP_TAG\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\ttag base\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n-\t\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n-\t)\n-'\n-\n-test_expect_success 'B: accept empty committer' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/empty-committer-1\n-\t\tcommitter  <> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tout=$(git fsck) &&\n-\t\techo \"$out\" &&\n-\t\ttest -z \"$out\"\n-\t)\n-'\n-\n-test_expect_success 'B: reject invalid timezone' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-timezone\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: accept invalid timezone with raw-permissive' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-timezone\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\tgit fast-import --date-format=raw-permissive <input &&\n-\t\tgit cat-file -p invalid-timezone >out &&\n-\t\ttest_grep \"1234567890 [+]051800\" out\n-\t)\n-'\n-\n-test_expect_success 'B: accept and fixup committer with no name' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/empty-committer-2\n-\t\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tout=$(git fsck) &&\n-\t\techo \"$out\" &&\n-\t\ttest -z \"$out\"\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (1)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (2)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (3)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name <email>> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (4)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name <email $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid committer (5)' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/invalid-committer\n-\t\tcommitter Name<email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tempty commit\n-\t\tCOMMIT\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of ..' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 100644 :1 ../invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of .' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tGood path\n-\t\tCOMMIT\n-\t\tM 100644 :1 ok-path\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tBad path\n-\t\tCOMMIT\n-\t\tR ok-path ./invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 100644 :1 C:/invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of .git' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 100644 :1 .git/invalid-path\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'B: fail on invalid file path of .gitmodules' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<EOF\n-\t\tFile contents\n-\t\tEOF\n-\n-\t\tcommit refs/heads/badpath\n-\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tCommit Message\n-\t\tCOMMIT\n-\t\tM 120000 :1 .gitmodules\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n ###\n ### series C\n ###\n@@ -841,155 +406,6 @@ test_expect_success 'D: verify file6' '\n \ttest_cmp expect actual\n '\n \n-###\n-### series E\n-###\n-\n-test_expect_success 'E: rfc2822 date, --date-format=raw' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n-\t\tdata <<COMMIT\n-\t\tRFC 2822 type date\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main^0\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import --date-format=raw <input\n-\t)\n-'\n-\n-test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n-\t\tdata <<COMMIT\n-\t\tRFC 2822 type date\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main^0\n-\n-\t\tINPUT_END\n-\n-\t\tgit -c fastimport.unpackLimit=0 fast-import --date-format=rfc2822 <input &&\n-\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n-\n-\t\tRFC 2822 type date\n-\t\tEOF\n-\t\tgit cat-file commit main | sed 1,2d >actual &&\n-\t\ttest_cmp expect actual &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack \"$p\" || return 1\n-\t\tdone\n-\t)\n-'\n-\n-###\n-### series F\n-###\n-\n-setup_two_commit_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_commit -C repo one &&\n-\ttest_commit -C repo two\n-}\n-\n-test_expect_success 'F: non-fast-forward update skips' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\told_branch=$(git rev-parse --verify main^0) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tlosing things already?\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main~1\n-\n-\t\treset refs/heads/other\n-\t\tfrom refs/heads/main\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git -c fastimport.unpackLimit=0 fast-import <input &&\n-\t\t# branch must remain unaffected\n-\t\ttest $old_branch = $(git rev-parse --verify main^0) &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack \"$p\" || return 1\n-\t\tdone &&\n-\n-\t\tcat >expect <<-EOF &&\n-\t\ttree $(git rev-parse main~1^{tree})\n-\t\tparent $(git rev-parse main~1)\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tlosing things already?\n-\t\tEOF\n-\t\tgit cat-file commit other >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-###\n-### series G\n-###\n-\n-test_expect_success 'G: non-fast-forward update forced' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\told_branch=$(git rev-parse --verify main^0) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/main\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tlosing things already?\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main~1\n-\n-\t\tINPUT_END\n-\t\tgit -c fastimport.unpackLimit=0 fast-import --force <input &&\n-\t\t# branch changed, but logged\n-\t\ttest $old_branch != $(git rev-parse --verify main^0) &&\n-\t\ttest $old_branch = $(git rev-parse --verify main@{1}) &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack \"$p\" || return 1\n-\t\tdone\n-\t)\n-'\n-\n ###\n ### series H\n ###\n@@ -1043,163 +459,6 @@ test_expect_success 'H: verify file' '\n \ttest_cmp expect actual\n '\n \n-###\n-### series I\n-###\n-\n-test_expect_success 'I: export-pack-edges option forbidden by default' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"option git export-pack-edges=edges.list\" >input &&\n-\t\ttest_must_fail git fast-import <input 2>err &&\n-\t\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n-\t)\n-'\n-\n-test_expect_success 'I: export-pack-edges' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init -b main repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/export-boundary\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\twe have a border.  its only 40 characters wide.\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\tINPUT_END\n-\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n-\t\t\t--export-pack-edges=edges.list <input &&\n-\n-\t\t# verify edge list\n-\t\tcat >expect <<-EOF &&\n-\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n-\t\tEOF\n-\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'I: export-pack-edges via stdin' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init -b main repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\toption git export-pack-edges=edges.list\n-\t\tcommit refs/heads/export-boundary\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tone more similar commit\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\tINPUT_END\n-\n-\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n-\t\t\t--allow-unsafe-features <input &&\n-\t\tcat >expect <<-EOF &&\n-\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n-\t\tEOF\n-\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-###\n-### series J\n-###\n-\n-test_expect_success 'J: reset existing branch creates empty commit' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/J\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcreate J\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\treset refs/heads/J\n-\n-\t\tcommit refs/heads/J\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tinitialize J\n-\t\tCOMMIT\n-\n-\t\tINPUT_END\n-\t\tgit fast-import <input &&\n-\t\t# branch has 1 commit, empty tree\n-\t\ttest 1 = $(git rev-list J | wc -l) &&\n-\t\ttest 0 = $(git ls-tree J | wc -l)\n-\t)\n-'\n-\n-test_expect_success 'J: tag must fail on empty branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\treset refs/heads/J2\n-\n-\t\ttag wrong_tag\n-\t\tfrom refs/heads/J2\n-\t\tdata <<EOF\n-\t\tTag branch that was reset.\n-\t\tEOF\n-\t\tINPUT_END\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-###\n-### series K\n-###\n-\n-test_expect_success 'K: reinit branch with from' '\n-\tsetup_two_commit_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/K\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcreate K\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main\n-\n-\t\tcommit refs/heads/K\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tredo K\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/main^1\n-\n-\t\tINPUT_END\n-\t\tgit fast-import <input &&\n-\t\t# K^1 = main^1\n-\t\ttest $(git rev-parse --verify main^1) \\\n-\t\t\t= $(git rev-parse --verify K^1)\n-\t)\n-'\n-\n ###\n ### series L\n ###\n@@ -1834,2500 +1093,7 @@ do\n \t'\n done\n \n-###\n-### series O\n-###\n \n-setup_import_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\tgit -C repo config fastimport.unpackLimit 0 &&\n-\tmkdir repo/file2 &&\n-\techo abcd >repo/file2/file4 &&\n-\tgit -C repo add file2/file4 &&\n-\ttest_tick &&\n-\tgit -C repo commit -m base\n-}\n-\n-import_reference_commit () {\n-\tgit fast-import <<-INPUT_END\n-\tcommit refs/heads/$1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tdirty directory copy\n-\tCOMMIT\n-\n-\tfrom refs/heads/main\n-\tM 644 inline file2/file5\n-\tdata <<EOF\n-\tan inline file.\n-\t  we should see it later.\n-\tEOF\n-\n-\tC file2 file3\n-\tD file2/file5\n-\n-\tINPUT_END\n-}\n-\n-test_expect_success 'O: comments are all skipped' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\t#we will\n-\t\tcommit refs/heads/O1\n-\t\t# -- ignore all of this text\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tdirty directory copy\n-\t\tCOMMIT\n-\n-\t\t# do not forget the import blank line!\n-\t\t#\n-\t\t# yes, we started from our usual base of main.\n-\t\t# i like main.\n-\t\tfrom refs/heads/main\n-\t\t# and we need to add file2/file5 to file2.\n-\t\tM 644 inline file2/file5\n-\t\t# otherwise the tree will be different\n-\t\tdata <<EOF\n-\t\tan inline file.\n-\t\t  we should see it later.\n-\t\tEOF\n-\n-\t\t# do not forget to copy file2 to file3\n-\t\tC file2 file3\n-\t\t#\n-\t\t# or to delete file5 from file2.\n-\t\tD file2/file5\n-\t\t# are we done yet?\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n-\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t100644 blob $blob4\tfile2/file4\n-\t\t100644 blob $blob4\tfile3/file4\n-\t\t100644 blob $blob5\tfile3/file5\n-\t\tEOF\n-\t\tgit ls-tree -r O1 >actual &&\n-\t\ttest_cmp expect actual &&\n-\n-\t\timport_reference_commit O1-reference &&\n-\t\ttest_cmp_rev O1-reference O1\n-\t)\n-'\n-\n-test_expect_success 'O: blank lines not necessary after data commands' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/O2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tdirty directory copy\n-\t\tCOMMIT\n-\t\tfrom refs/heads/main\n-\t\tM 644 inline file2/file5\n-\t\tdata <<EOF\n-\t\tan inline file.\n-\t\t  we should see it later.\n-\t\tEOF\n-\t\tC file2 file3\n-\t\tD file2/file5\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n-\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t100644 blob $blob4\tfile2/file4\n-\t\t100644 blob $blob4\tfile3/file4\n-\t\t100644 blob $blob5\tfile3/file5\n-\t\tEOF\n-\t\tgit ls-tree -r O2 >actual &&\n-\t\ttest_cmp expect actual &&\n-\n-\t\timport_reference_commit O2-reference &&\n-\t\ttest_cmp_rev O2-reference O2\n-\t)\n-'\n-\n-test_expect_success 'O: blank lines not necessary after other commands' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tgit repack -a -d &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/O3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzstring\n-\t\tCOMMIT\n-\t\tcommit refs/heads/O3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzof\n-\t\tCOMMIT\n-\t\tcheckpoint\n-\t\tcommit refs/heads/O3\n-\t\tmark :5\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzempty\n-\t\tCOMMIT\n-\t\tcheckpoint\n-\t\tcommit refs/heads/O3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzcommits\n-\t\tCOMMIT\n-\t\treset refs/tags/O3-2nd\n-\t\tfrom :5\n-\t\treset refs/tags/O3-3rd\n-\t\tfrom :5\n-\t\tINPUT_END\n-\n-\t\tcat >expect <<-INPUT_END &&\n-\t\tstring\n-\t\tof\n-\t\tempty\n-\t\tcommits\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input &&\n-\t\tls -la .git/objects/pack/pack-*.pack >packlist &&\n-\t\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n-\t\ttest_line_count = 4 idxlist &&\n-\t\ttest_line_count = 4 packlist &&\n-\t\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n-\t\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'O: progress outputs as requested by input' '\n-\tsetup_import_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzstring\n-\t\tCOMMIT\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzof\n-\t\tCOMMIT\n-\t\tprogress Two commits down, 2 to go!\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzempty\n-\t\tCOMMIT\n-\t\tprogress Three commits down, 1 to go!\n-\t\tcommit refs/heads/O4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tzcommits\n-\t\tCOMMIT\n-\t\tprogress done!\n-\t\tINPUT_END\n-\t\tgit fast-import <input >actual &&\n-\t\tgrep \"progress \" <input >expect &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-###\n-### series P (gitlinks)\n-###\n-\n-setup_gitlinks_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_commit -C repo base &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 10\n-\t\ttest file\n-\n-\t\treset refs/heads/sub\n-\t\tcommit refs/heads/sub\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 12\n-\t\tsub_initial\n-\t\tM 100644 :1 file\n-\n-\t\tblob\n-\t\tmark :3\n-\t\tdata <<DATAEND\n-\t\t[submodule \"sub\"]\n-\t\t\tpath = sub\n-\t\t\turl = \"$(pwd)/sub\"\n-\t\tDATAEND\n-\n-\t\tcommit refs/heads/subuse1\n-\t\tmark :4\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 8\n-\t\tinitial\n-\t\tfrom refs/heads/main\n-\t\tM 100644 :3 .gitmodules\n-\t\tM 160000 :2 sub\n-\n-\t\tblob\n-\t\tmark :5\n-\t\tdata 20\n-\t\ttest file\n-\t\tmore data\n-\n-\t\tcommit refs/heads/sub\n-\t\tmark :6\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 11\n-\t\tsub_second\n-\t\tfrom :2\n-\t\tM 100644 :5 file\n-\n-\t\tcommit refs/heads/subuse1\n-\t\tmark :7\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 7\n-\t\tsecond\n-\t\tfrom :4\n-\t\tM 160000 :6 sub\n-\n-\t\tINPUT_END\n-\n-\t\tgit fast-import <input\n-\t)\n-}\n-\n-test_expect_success 'P: superproject & submodule mix' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit checkout subuse1 &&\n-\t\trm -rf sub &&\n-\t\tmkdir sub &&\n-\t\t(\n-\t\t\tcd sub &&\n-\t\t\tgit init &&\n-\t\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n-\t\t\tgit checkout main\n-\t\t) &&\n-\t\tgit submodule init &&\n-\t\tgit submodule update\n-\t)\n-'\n-\n-test_expect_success 'P: verbatim SHA gitlinks' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tSUBLAST=$(git rev-parse --verify sub) &&\n-\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n-\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<DATAEND\n-\t\t[submodule \"sub\"]\n-\t\t\tpath = sub\n-\t\t\turl = \"$(pwd)/sub\"\n-\t\tDATAEND\n-\n-\t\tcommit refs/heads/subuse2\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 8\n-\t\tinitial\n-\t\tfrom refs/heads/main\n-\t\tM 100644 :1 .gitmodules\n-\t\tM 160000 $SUBPREV sub\n-\n-\t\tcommit refs/heads/subuse2\n-\t\tmark :3\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata 7\n-\t\tsecond\n-\t\tfrom :2\n-\t\tM 160000 $SUBLAST sub\n-\n-\t\tINPUT_END\n-\n-\t\tgit branch -D sub &&\n-\t\tgit gc --prune=now &&\n-\t\tgit fast-import <input &&\n-\t\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n-\t)\n-'\n-\n-test_expect_success 'P: fail on inline gitlink' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/subuse3\n-\t\tmark :1\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcorrupt\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/subuse1\n-\t\tM 160000 inline sub\n-\t\tdata <<DATA\n-\t\t$SUBPREV\n-\t\tDATA\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'P: fail on blob mark in gitlink' '\n-\tsetup_gitlinks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<DATA\n-\t\t$SUBPREV\n-\t\tDATA\n-\n-\t\tcommit refs/heads/subuse3\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcorrupt\n-\t\tCOMMIT\n-\n-\t\tfrom refs/heads/subuse1\n-\t\tM 160000 :1 sub\n-\n-\t\tINPUT_END\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-###\n-### series Q (notes)\n-###\n-\n-setup_notes_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\tfile2_data=\"file2\n-second line of EOF\" &&\n-\tfile4_data=abcd &&\n-\tfile4_len=4 &&\n-\tfile5_data=\"an inline file.\n-  we should see it later.\" &&\n-\tfile6_data=\"#!/bin/sh\n-echo \\\"\\$@\\\"\" &&\n-\tnote1_data=\"The first note for the first commit\" &&\n-\tnote2_data=\"The first note for the second commit\" &&\n-\tnote3_data=\"The first note for the third commit\" &&\n-\tnote1b_data=\"The second note for the first commit\" &&\n-\tnote1c_data=\"The third note for the first commit\" &&\n-\tnote2b_data=\"The second note for the second commit\" &&\n-\n-\ttest_tick &&\n-\tcat >repo/input <<-INPUT_END &&\n-\tblob\n-\tmark :2\n-\tdata <<EOF\n-\t$file2_data\n-\tEOF\n-\n-\tcommit refs/heads/notes-test\n-\tmark :3\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tfirst (:3)\n-\tCOMMIT\n-\n-\tM 644 :2 file2\n-\n-\tblob\n-\tmark :4\n-\tdata $file4_len\n-\t$file4_data\n-\tcommit refs/heads/notes-test\n-\tmark :5\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tsecond (:5)\n-\tCOMMIT\n-\n-\tM 644 :4 file4\n-\n-\tcommit refs/heads/notes-test\n-\tmark :6\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tthird (:6)\n-\tCOMMIT\n-\n-\tM 644 inline file5\n-\tdata <<EOF\n-\t$file5_data\n-\tEOF\n-\n-\tM 755 inline file6\n-\tdata <<EOF\n-\t$file6_data\n-\tEOF\n-\n-\tblob\n-\tmark :7\n-\tdata <<EOF\n-\t$note1_data\n-\tEOF\n-\n-\tblob\n-\tmark :8\n-\tdata <<EOF\n-\t$note2_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar\n-\tmark :9\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:9)\n-\tCOMMIT\n-\n-\tN :7 :3\n-\tN :8 :5\n-\tN inline :6\n-\tdata <<EOF\n-\t$note3_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar\n-\tmark :10\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:10)\n-\tCOMMIT\n-\n-\tN inline :3\n-\tdata <<EOF\n-\t$note1b_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar2\n-\tmark :11\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:11)\n-\tCOMMIT\n-\n-\tN inline :3\n-\tdata <<EOF\n-\t$note1c_data\n-\tEOF\n-\n-\tcommit refs/notes/foobar\n-\tmark :12\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tnotes (:12)\n-\tCOMMIT\n-\n-\tdeleteall\n-\tN inline :5\n-\tdata <<EOF\n-\t$note2b_data\n-\tEOF\n-\n-\tINPUT_END\n-\n-\tgit -C repo fast-import <repo/input &&\n-\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n-\tcommit2=$(git -C repo rev-parse notes-test^) &&\n-\tcommit3=$(git -C repo rev-parse notes-test)\n-}\n-\n-test_expect_success 'Q: verify first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tfirst (:3)\n-\t\tEOF\n-\t\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $commit1\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tsecond (:5)\n-\t\tEOF\n-\t\tgit cat-file commit notes-test^ | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $commit2\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tthird (:6)\n-\t\tEOF\n-\t\tgit cat-file commit notes-test | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:9)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit1\n-\t\t100644 blob $commit2\n-\t\t100644 blob $commit3\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note1_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note2_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for third commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note3_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $(git rev-parse --verify refs/notes/foobar~2)\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:10)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit1\n-\t\t100644 blob $commit2\n-\t\t100644 blob $commit3\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second note for first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note1b_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note2_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify first note for third commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note3_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:11)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit1\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify third note for first commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note1c_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify fourth notes commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >expect <<-EOF &&\n-\t\tparent $(git rev-parse --verify refs/notes/foobar^)\n-\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-\t\tnotes (:12)\n-\t\tEOF\n-\t\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify fourth notes tree' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tsort >expect <<-EOF &&\n-\t\t100644 blob $commit2\n-\t\tEOF\n-\t\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: verify second note for second commit' '\n-\tsetup_notes_repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"$note2b_data\" >expect &&\n-\t\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'Q: deny note on empty branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcat >input <<-EOF &&\n-\t\treset refs/heads/Q0\n-\n-\t\tcommit refs/heads/note-Q0\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tNote for an empty branch.\n-\t\tCOMMIT\n-\n-\t\tN inline refs/heads/Q0\n-\t\tdata <<NOTE\n-\t\tsome note\n-\t\tNOTE\n-\t\tEOF\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-###\n-### series R (feature and option)\n-###\n-\n-test_expect_success 'R: abort on unsupported feature' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature no-such-feature-exists\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: supported feature is accepted' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature date-format=now\n-\t\tEOF\n-\n-\t\tgit fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: abort on receiving feature after data command' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tblob\n-\t\tdata 3\n-\t\thi\n-\t\tfeature date-format=now\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: import-marks features forbidden by default' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t>git.marks &&\n-\t\techo \"feature import-marks=git.marks\" >input &&\n-\t\ttest_must_fail git fast-import <input &&\n-\t\techo \"feature import-marks-if-exists=git.marks\" >input &&\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: only one import-marks feature allowed per stream' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t>git.marks &&\n-\t\t>git2.marks &&\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=git.marks\n-\t\tfeature import-marks=git2.marks\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import --allow-unsafe-features <input\n-\t)\n-'\n-\n-test_expect_success 'R: export-marks feature forbidden by default' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature export-marks=git.marks\" >input &&\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: export-marks feature results in a marks file being created' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature export-marks=git.marks\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_grep :1 git.marks\n-\t)\n-'\n-\n-test_expect_success 'R: export-marks options can be overridden by commandline options' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-\\EOF &&\n-\t\tfeature export-marks=feature-sub/git.marks\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\tgit fast-import --allow-unsafe-features \\\n-\t\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n-\t\ttest_grep :1 cmdline-sub/other.marks &&\n-\t\ttest_path_is_missing feature-sub\n-\t)\n-'\n-\n-test_expect_success 'R: --allow-unsafe-features found after a value' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n-\t\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n-\t\tgit fast-import --date-format raw --allow-unsafe-features <input\n-\t)\n-'\n-\n-test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\t\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n-\t\tgit fast-import --allow-unsafe <input\n-\t)\n-'\n-\n-test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n-\t\t\tgit fast-import --allow-unsafe <input 2>err &&\n-\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n-\t)\n-'\n-\n-test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n-\t\t\tgit fast-import --quiet --export-pack \\\n-\t\t\t--allow-unsafe-features <input 2>err &&\n-\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n-\t)\n-'\n-\n-test_expect_success 'R: --allow-unsafe-features after a non-option' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n-\t\ttest_must_fail git fast-import --depth 5 extra \\\n-\t\t\t--allow-unsafe-features <input 2>err &&\n-\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n-\t)\n-'\n-\n-test_expect_success 'R: catch typo in marks file name' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n-\t\techo \"feature import-marks=nonexistent.marks\" |\n-\t\ttest_must_fail git fast-import --allow-unsafe-features\n-\t)\n-'\n-\n-test_expect_success 'R: import and output marks can be the same file' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\tblob=$(echo hi | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t:1 $blob\n-\t\t:2 $blob\n-\t\tEOF\n-\t\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n-\t\tblob\n-\t\tmark :2\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks\n-\t)\n-'\n-\n-test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t)\n-'\n-\n-test_expect_success 'R: --import-marks-if-exists' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\tblob=$(echo hi | git hash-object --stdin) &&\n-\t\techo \":1 $blob\" >expect &&\n-\t\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks\n-\t)\n-'\n-\n-test_expect_success 'R: feature import-marks-if-exists' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\n-\t\tgit fast-import --export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=not_io.marks\n-\t\tEOF\n-\t\ttest_must_be_empty io.marks &&\n-\n-\t\tblob=$(echo hi | git hash-object -w --stdin) &&\n-\n-\t\techo \":1 $blob\" >io.marks &&\n-\t\techo \":1 $blob\" >expect &&\n-\t\techo \":2 $blob\" >>expect &&\n-\n-\t\tgit fast-import --export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=io.marks\n-\t\tblob\n-\t\tmark :2\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks &&\n-\n-\t\techo \":3 $blob\" >>expect &&\n-\n-\t\tgit fast-import --import-marks=io.marks \\\n-\t\t\t\t--export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=not_io.marks\n-\t\tblob\n-\t\tmark :3\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks &&\n-\n-\t\tgit fast-import --import-marks-if-exists=not_io.marks \\\n-\t\t\t\t--export-marks=io.marks \\\n-\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n-\t\tfeature import-marks-if-exists=io.marks\n-\t\tEOF\n-\t\ttest_must_be_empty io.marks\n-\t)\n-'\n-\n-create_marks_file () {\n-\tgit fast-import --export-marks=\"$1\" <<-EOF\n-\tblob\n-\tmark :1\n-\tdata 4\n-\tone\n-\n-\tblob\n-\tmark :2\n-\tdata 4\n-\ttwo\n-\n-\tblob\n-\tmark :3\n-\tdata 6\n-\tthree\n-\n-\tblob\n-\tmark :4\n-\tdata 5\n-\tfour\n-\n-\tcommit refs/heads/marks\n-\tmark :5\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit with a mark\n-\tCOMMIT\n-\tM 100644 :1 one\n-\n-\ttag marks-tag\n-\tmark :6\n-\tfrom :5\n-\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<TAG\n-\ttag with a mark\n-\tTAG\n-\n-\tEOF\n-}\n-\n-test_expect_success 'R: import to output marks works without any content' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=marks.out\n-\t\tfeature export-marks=marks.new\n-\t\tEOF\n-\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out marks.new\n-\t)\n-'\n-\n-test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=nonexistent.marks\n-\t\tfeature export-marks=marks.new\n-\t\tEOF\n-\n-\t\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out marks.new\n-\t)\n-'\n-\n-test_expect_success 'R: multiple --import-marks= should be honoured' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature import-marks=nonexistent.marks\n-\t\tfeature export-marks=combined.marks\n-\t\tEOF\n-\n-\t\thead -n2 marks.out >one.marks &&\n-\t\ttail -n +3 marks.out >two.marks &&\n-\t\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n-\t\t\t--allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out combined.marks\n-\t)\n-'\n-\n-test_expect_success 'R: feature relative-marks should be honoured' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature relative-marks\n-\t\tfeature import-marks=relative.in\n-\t\tfeature export-marks=relative.out\n-\t\tEOF\n-\n-\t\tmkdir -p .git/info/fast-import/ &&\n-\t\tcp marks.out .git/info/fast-import/relative.in &&\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out .git/info/fast-import/relative.out\n-\t)\n-'\n-\n-test_expect_success 'R: feature no-relative-marks should be honoured' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\tcreate_marks_file marks.out &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\tfeature relative-marks\n-\t\tfeature import-marks=relative.in\n-\t\tfeature no-relative-marks\n-\t\tfeature export-marks=non-relative.out\n-\t\tEOF\n-\n-\t\tmkdir -p .git/info/fast-import/ &&\n-\t\tcp marks.out .git/info/fast-import/relative.in &&\n-\t\tgit fast-import --allow-unsafe-features <input &&\n-\t\ttest_cmp marks.out non-relative.out\n-\t)\n-'\n-\n-\n-test_expect_success 'R: feature ls supported' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature ls\" |\n-\t\tgit fast-import\n-\t)\n-'\n-\n-test_expect_success 'R: feature cat-blob supported' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"feature cat-blob\" |\n-\t\tgit fast-import\n-\t)\n-'\n-\n-test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print old blob' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 11\n-\t\tyes it can\n-\n-\t\tEOF\n-\t\techo \"cat-blob $blob\" |\n-\t\tgit fast-import --cat-blob-fd=6 6>actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo hello >greeting &&\n-\t\tblob=$(git hash-object -w greeting) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 6\n-\t\thello\n-\n-\t\tEOF\n-\t\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n-\t\tcat-blob $blob\n-\t\tEOF\n-\t\ttest_cmp expect actual.3 &&\n-\t\ttest_must_be_empty actual.1 &&\n-\t\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n-\t\toption cat-blob-fd=3\n-\t\tcat-blob $blob\n-\t\tEOF\n-\t\ttest_must_be_empty actual.3 &&\n-\t\ttest_cmp expect actual.1\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print mark for new blob' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"effluentish\" | git hash-object --stdin >expect &&\n-\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB_END\n-\t\teffluentish\n-\t\tBLOB_END\n-\t\tget-mark :1\n-\t\tEOF\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print new blob' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 12\n-\t\tyep yep yep\n-\n-\t\tEOF\n-\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB_END\n-\t\tyep yep yep\n-\t\tBLOB_END\n-\t\tcat-blob :1\n-\t\tEOF\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success !MINGW 'R: print new blob by sha1' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t${blob} blob 25\n-\t\ta new blob named by sha1\n-\n-\t\tEOF\n-\t\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n-\t\tblob\n-\t\tdata <<BLOB_END\n-\t\ta new blob named by sha1\n-\t\tBLOB_END\n-\t\tcat-blob $blob\n-\t\tEOF\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-setup_big_file () {\n-\t(\n-\t\techo \"the quick brown fox jumps over the lazy dog\" >big &&\n-\t\tfor i in 1 2 3\n-\t\tdo\n-\t\t\tcat big big big big >bigger &&\n-\t\t\tcat bigger bigger bigger bigger >big ||\n-\t\t\texit\n-\t\tdone\n-\t)\n-}\n-\n-test_expect_success 'R: print two blobs to stdout' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsetup_big_file &&\n-\t\tblob1=$(git hash-object big) &&\n-\t\tblob1_len=$(wc -c <big) &&\n-\t\tblob2=$(echo hello | git hash-object --stdin) &&\n-\t\t{\n-\t\t\techo ${blob1} blob $blob1_len &&\n-\t\t\tcat big &&\n-\t\t\tcat <<-EOF\n-\n-\t\t\t${blob2} blob 6\n-\t\t\thello\n-\n-\t\t\tEOF\n-\t\t} >expect &&\n-\t\t{\n-\t\t\tcat <<-\\END_PART1 &&\n-\t\t\t\tblob\n-\t\t\t\tmark :1\n-\t\t\t\tdata <<data_end\n-\t\t\tEND_PART1\n-\t\t\tcat big &&\n-\t\t\tcat <<-\\EOF\n-\t\t\t\tdata_end\n-\t\t\t\tblob\n-\t\t\t\tmark :2\n-\t\t\t\tdata <<data_end\n-\t\t\t\thello\n-\t\t\t\tdata_end\n-\t\t\t\tcat-blob :1\n-\t\t\t\tcat-blob :2\n-\t\t\tEOF\n-\t\t} |\n-\t\tgit fast-import >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success PIPE 'R: copy using cat-file' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsetup_big_file &&\n-\t\texpect_id=$(git hash-object big) &&\n-\t\texpect_len=$(wc -c <big) &&\n-\t\techo $expect_id blob $expect_len >expect.response &&\n-\n-\t\trm -f blobs &&\n-\n-\t\tmkfifo blobs &&\n-\t\t(\n-\t\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n-\t\t\tcat <<-\\EOF &&\n-\t\t\tfeature cat-blob\n-\t\t\tblob\n-\t\t\tmark :1\n-\t\t\tdata <<BLOB\n-\t\t\tEOF\n-\t\t\tcat big &&\n-\t\t\tcat <<-\\EOF &&\n-\t\t\tBLOB\n-\t\t\tcat-blob :1\n-\t\t\tEOF\n-\n-\t\t\tread blob_id type size <&3 &&\n-\t\t\techo \"$blob_id $type $size\" >response &&\n-\t\t\ttest_copy_bytes $size >blob <&3 &&\n-\t\t\tread newline <&3 &&\n-\n-\t\t\tcat <<-EOF &&\n-\t\t\tcommit refs/heads/copied\n-\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\t\tdata <<COMMIT\n-\t\t\tcopy big file as file3\n-\t\t\tCOMMIT\n-\t\t\tM 644 inline file3\n-\t\t\tdata <<BLOB\n-\t\t\tEOF\n-\t\t\tcat blob &&\n-\t\t\techo BLOB\n-\t\t) 3<blobs |\n-\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\t\tgit show copied:file3 >actual &&\n-\t\ttest_cmp expect.response response &&\n-\t\ttest_cmp big actual\n-\t)\n-'\n-\n-test_expect_success PIPE 'R: print blob mid-commit' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f blobs &&\n-\t\techo \"A blob from _before_ the commit.\" >expect &&\n-\t\tmkfifo blobs &&\n-\t\t(\n-\t\t\texec 3<blobs &&\n-\t\t\tcat <<-EOF &&\n-\t\t\tfeature cat-blob\n-\t\t\tblob\n-\t\t\tmark :1\n-\t\t\tdata <<BLOB\n-\t\t\tA blob from _before_ the commit.\n-\t\t\tBLOB\n-\t\t\tcommit refs/heads/temporary\n-\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\t\tdata <<COMMIT\n-\t\t\tEmpty commit\n-\t\t\tCOMMIT\n-\t\t\tcat-blob :1\n-\t\t\tEOF\n-\n-\t\t\tread blob_id type size <&3 &&\n-\t\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\t\tread newline <&3 &&\n-\n-\t\t\techo\n-\t\t) |\n-\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success PIPE 'R: print staged blob within commit' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f blobs &&\n-\t\techo \"A blob from _within_ the commit.\" >expect &&\n-\t\tmkfifo blobs &&\n-\t\t(\n-\t\t\texec 3<blobs &&\n-\t\t\tcat <<-EOF &&\n-\t\t\tfeature cat-blob\n-\t\t\tcommit refs/heads/within\n-\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\t\tdata <<COMMIT\n-\t\t\tEmpty commit\n-\t\t\tCOMMIT\n-\t\t\tM 644 inline within\n-\t\t\tdata <<BLOB\n-\t\t\tA blob from _within_ the commit.\n-\t\t\tBLOB\n-\t\t\tEOF\n-\n-\t\t\tto_get=$(\n-\t\t\t\techo \"A blob from _within_ the commit.\" |\n-\t\t\t\tgit hash-object --stdin\n-\t\t\t) &&\n-\t\t\techo \"cat-blob $to_get\" &&\n-\n-\t\t\tread blob_id type size <&3 &&\n-\t\t\ttest_copy_bytes $size >actual <&3 &&\n-\t\t\tread newline <&3 &&\n-\n-\t\t\techo deleteall\n-\t\t) |\n-\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'R: quiet option results in no stats being output' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\toption git quiet\n-\t\tblob\n-\t\tdata 3\n-\t\thi\n-\n-\t\tEOF\n-\n-\t\tgit fast-import 2>output <input &&\n-\t\ttest_must_be_empty output\n-\t)\n-'\n-\n-test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo feature done | test_must_fail git fast-import &&\n-\t\ttest_must_fail git fast-import --done </dev/null\n-\t)\n-'\n-\n-test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit fast-import <<-\\EOF &&\n-\t\tfeature done\n-\t\tdone\n-\t\ttrailing gibberish\n-\t\tEOF\n-\t\tgit fast-import <<-\\EOF\n-\t\tdone\n-\t\tmore trailing gibberish\n-\t\tEOF\n-\t)\n-'\n-\n-test_expect_success 'R: terminating \"done\" within commit' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >expect <<-\\EOF &&\n-\t\tOBJID\n-\t\t:000000 100644 OBJID OBJID A\thello.c\n-\t\t:000000 100644 OBJID OBJID A\thello2.c\n-\t\tEOF\n-\t\tgit fast-import <<-EOF &&\n-\t\tcommit refs/heads/done-ends\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<EOT\n-\t\tCommit terminated by \"done\" command\n-\t\tEOT\n-\t\tM 100644 inline hello.c\n-\t\tdata <<EOT\n-\t\tHello, world.\n-\t\tEOT\n-\t\tC hello.c hello2.c\n-\t\tdone\n-\t\tEOF\n-\t\tgit rev-list done-ends |\n-\t\tgit diff-tree -r --stdin --root --always |\n-\t\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n-\t\ttest_cmp expect actual\n-\t)\n-'\n-\n-test_expect_success 'R: die on unknown option' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\toption git non-existing-option\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: unknown commandline options are rejected' '\\\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --non-existing-option < /dev/null\n-\t)\n-'\n-\n-test_expect_success 'R: feature-only names are rejected on the command line' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tfor opt in --alias --get-mark --ls --notes\n-\t\tdo\n-\t\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n-\t\tdone\n-\t)\n-'\n-\n-test_expect_success 'R: die on invalid option argument' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\techo \"option git active-branches=-5\" |\n-\t\ttest_must_fail git fast-import &&\n-\t\techo \"option git depth=\" |\n-\t\ttest_must_fail git fast-import &&\n-\t\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n-\t)\n-'\n-\n-test_expect_success 'R: ignore non-git options' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tcat >input <<-EOF &&\n-\t\toption non-existing-vcs non-existing-option\n-\t\tEOF\n-\n-\t\tgit fast-import <input\n-\t)\n-'\n-\n-test_expect_success 'R: corrupt lines do not mess marks file' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\trm -f io.marks &&\n-\t\tblob=$(echo hi | git hash-object --stdin) &&\n-\t\tcat >expect <<-EOF &&\n-\t\t:3 $ZERO_OID\n-\t\t:1 $blob\n-\t\t:2 $blob\n-\t\tEOF\n-\t\tcp expect io.marks &&\n-\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n-\n-\t\tEOF\n-\t\ttest_cmp expect io.marks\n-\t)\n-'\n-\n-##\n-## R: very large blobs\n-##\n-test_expect_success 'R: blob bigger than threshold' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tblobsize=$((2*1024*1024 + 53)) &&\n-\t\ttest-tool genrandom bar $blobsize >expect &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/big-file\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tR - big file\n-\t\tCOMMIT\n-\n-\t\tM 644 inline big1\n-\t\tdata $blobsize\n-\t\tINPUT_END\n-\t\tcat expect >>input &&\n-\t\tcat >>input <<-INPUT_END &&\n-\t\tM 644 inline big2\n-\t\tdata $blobsize\n-\t\tINPUT_END\n-\t\tcat expect >>input &&\n-\t\techo >>input &&\n-\n-\t\tgit -c fastimport.unpackLimit=0 fast-import --big-file-threshold=1 <input &&\n-\n-\t\tfor p in .git/objects/pack/*.pack\n-\t\tdo\n-\t\t\tgit verify-pack -v \"$p\" || return 1\n-\t\tdone >verify &&\n-\n-\t\tgit cat-file blob big-file:big1 >actual &&\n-\t\ttest_cmp_bin expect actual &&\n-\t\ta=$(git rev-parse big-file:big1) &&\n-\t\tb=$(git rev-parse big-file:big2) &&\n-\t\ttest $a = $b &&\n-\t\tn=$(grep $a verify | wc -l) &&\n-\t\ttest 1 = $n\n-\t)\n-'\n-\n-test_expect_success 'R: --git-completion-helper does not read from stdin' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n-\t\techo garbage | git fast-import --git-completion-helper >out &&\n-\t\ttest_grep -e \"--date-format=\" out &&\n-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n-\t\ttest_cmp before after\n-\t)\n-'\n-\n-test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n-\t\techo garbage | git fast-import --git-completion-helper-all >all &&\n-\t\ttest_grep -e \"--allow-unsafe-features\" all &&\n-\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n-\t\ttest_cmp before after\n-\t)\n-'\n-\n-###\n-### series S (mark and path parsing)\n-###\n-#\n-# Make sure missing spaces and EOLs after mark references\n-# cause errors.\n-#\n-# Setup:\n-#\n-#   1--2--4\n-#    \\   /\n-#     -3-\n-#\n-#   commit marks:  301, 302, 303, 304\n-#   blob marks:              403, 404, resp.\n-#   note mark:          202\n-#\n-# The error message when a space is missing not at the\n-# end of the line is:\n-#\n-#   missing space after ..\n-#\n-# or when extra characters come after the mark at the end\n-# of the line:\n-#\n-#   garbage after ..\n-#\n-# or when the dataref is neither \"inline \" or a known SHA1,\n-#\n-#   invalid dataref ..\n-#\n-setup_marks_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_tick &&\n-\n-\tcat >repo/input <<-INPUT_END &&\n-\tcommit refs/heads/S\n-\tmark :301\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 1\n-\tCOMMIT\n-\tM 100644 inline hello.c\n-\tdata <<BLOB\n-\tblob 1\n-\tBLOB\n-\n-\tcommit refs/heads/S\n-\tmark :302\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcommit 2\n-\tCOMMIT\n-\tfrom :301\n-\tM 100644 inline hello.c\n-\tdata <<BLOB\n-\tblob 2\n-\tBLOB\n-\n-\tblob\n-\tmark :403\n-\tdata <<BLOB\n-\tblob 3\n-\tBLOB\n-\n-\tblob\n-\tmark :202\n-\tdata <<BLOB\n-\tnote 2\n-\tBLOB\n-\tINPUT_END\n-\n-\tgit -C repo fast-import --export-marks=marks <repo/input\n-}\n-\n-#\n-# filemodify, three datarefs\n-#\n-test_expect_success 'S: filemodify with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit N\n-\t\tCOMMIT\n-\t\tM 100644 :403x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after mark\" err\n-\t)\n-'\n-\n-# inline is misspelled; fast-import thinks it is some unknown dataref\n-test_expect_success 'S: filemodify with garbage after inline must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit N\n-\t\tCOMMIT\n-\t\tM 100644 inlineX hello.c\n-\t\tdata <<BLOB\n-\t\tinline\n-\t\tBLOB\n-\t\tEOF\n-\t\ttest_grep \"nvalid dataref\" err\n-\t)\n-'\n-\n-test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit N\n-\t\tCOMMIT\n-\t\tM 100644 ${sha1}x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after SHA1\" err\n-\t)\n-'\n-\n-#\n-# notemodify, three ways to say dataref\n-#\n-test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note dataref markref\n-\t\tCOMMIT\n-\t\tN :202x :302\n-\t\tEOF\n-\t\ttest_grep \"space after mark\" err\n-\t)\n-'\n-\n-test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note dataref inline\n-\t\tCOMMIT\n-\t\tN inlineX :302\n-\t\tdata <<BLOB\n-\t\tnote blob\n-\t\tBLOB\n-\t\tEOF\n-\t\ttest_grep \"nvalid dataref\" err\n-\t)\n-'\n-\n-test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note dataref sha1\n-\t\tCOMMIT\n-\t\tN ${sha1}x :302\n-\t\tEOF\n-\t\ttest_grep \"space after SHA1\" err\n-\t)\n-'\n-\n-#\n-# notemodify, mark in commit-ish\n-#\n-test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/Snotes\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit S note commit-ish\n-\t\tCOMMIT\n-\t\tN :202 :302x\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# from\n-#\n-test_expect_success 'S: from with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail \\\n-\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S2\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit 3\n-\t\tCOMMIT\n-\t\tfrom :301x\n-\t\tM 100644 :403 hello.c\n-\t\tEOF\n-\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-\n-#\n-# merge\n-#\n-test_expect_success 'S: merge with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n-\t\tcommit refs/heads/S2\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit 3\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tM 100644 :403 hello.c\n-\t\tEOF\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcommit refs/heads/S\n-\t\tmark :304\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tmerge 4\n-\t\tCOMMIT\n-\t\tfrom :302\n-\t\tmerge :303x\n-\t\tM 100644 :403 hello.c\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# tag, from markref\n-#\n-test_expect_success 'S: tag with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\ttag refs/tags/Stag\n-\t\tfrom :302x\n-\t\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<TAG\n-\t\ttag S\n-\t\tTAG\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# cat-blob markref\n-#\n-test_expect_success 'S: cat-blob with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tcat-blob :403x\n-\t\tEOF\n-\t\ttest_grep \"after mark\" err\n-\t)\n-'\n-\n-#\n-# ls markref\n-#\n-test_expect_success 'S: ls with garbage after mark must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tls :302x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after mark\" err\n-\t)\n-'\n-\n-test_expect_success 'S: ls with garbage after sha1 must fail' '\n-\tsetup_marks_repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n-\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n-\t\tls ${sha1}x hello.c\n-\t\tEOF\n-\t\ttest_grep \"space after tree-ish\" err\n-\t)\n-'\n-\n-#\n-# Path parsing\n-#\n-# There are two sorts of ways a path can be parsed, depending on whether it is\n-# the last field on the line. Additionally, ls without a <dataref> has a special\n-# case. Test every occurrence of <path> in the grammar against every error case.\n-# Paths for the root (empty strings) are tested elsewhere.\n-#\n-\n-#\n-# Valid paths at the end of a line: filemodify, filedelete, filecopy (dest),\n-# filerename (dest), and ls.\n-#\n-# commit :301 from root -- modify hello.c (for setup)\n-# commit :302 from :301 -- modify $path\n-# commit :303 from :302 -- delete $path\n-# commit :304 from :301 -- copy hello.c $path\n-# commit :305 from :301 -- rename hello.c $path\n-# ls :305 $path\n-#\n-test_path_eol_success () {\n-\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths at EOL with $test must work\" '\n-\t\ttest_when_finished \"git branch -D S-path-eol\" &&\n-\n-\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF >out 2>err &&\n-\t\tblob\n-\t\tmark :401\n-\t\tdata <<BLOB\n-\t\thello world\n-\t\tBLOB\n-\n-\t\tblob\n-\t\tmark :402\n-\t\tdata <<BLOB\n-\t\thallo welt\n-\t\tBLOB\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :301\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tinitial commit\n-\t\tCOMMIT\n-\t\tM 100644 :401 hello.c\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :302\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filemodify\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tM 100644 :402 $path\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filedelete\n-\t\tCOMMIT\n-\t\tfrom :302\n-\t\tD $path\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :304\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filecopy dest\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tC hello.c $path\n-\n-\t\tcommit refs/heads/S-path-eol\n-\t\tmark :305\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filerename dest\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tR hello.c $path\n-\n-\t\tls :305 $path\n-\t\tEOF\n-\n-\t\tcommit_m=$(grep :302 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_d=$(grep :303 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_c=$(grep :304 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_r=$(grep :305 marks.out | cut -d\\  -f2) &&\n-\t\tblob1=$(grep :401 marks.out | cut -d\\  -f2) &&\n-\t\tblob2=$(grep :402 marks.out | cut -d\\  -f2) &&\n-\n-\t\t(\n-\t\t\tprintf \"100644 blob $blob2\\t$unquoted_path\\n\" &&\n-\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n-\t\t) | sort >tree_m.exp &&\n-\t\tgit ls-tree $commit_m | sort >tree_m.out &&\n-\t\ttest_cmp tree_m.exp tree_m.out &&\n-\n-\t\tprintf \"100644 blob $blob1\\thello.c\\n\" >tree_d.exp &&\n-\t\tgit ls-tree $commit_d >tree_d.out &&\n-\t\ttest_cmp tree_d.exp tree_d.out &&\n-\n-\t\t(\n-\t\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" &&\n-\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n-\t\t) | sort >tree_c.exp &&\n-\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n-\t\ttest_cmp tree_c.exp tree_c.out &&\n-\n-\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" >tree_r.exp &&\n-\t\tgit ls-tree $commit_r >tree_r.out &&\n-\t\ttest_cmp tree_r.exp tree_r.out &&\n-\n-\t\ttest_cmp out tree_r.exp\n-\t'\n-}\n-\n-test_path_eol_success 'quoted spaces'   '\" hello world.c \"'  ' hello world.c '\n-test_path_eol_success 'unquoted spaces' ' hello world.c '    ' hello world.c '\n-test_path_eol_success 'octal escapes'   '\"\\150\\151\\056\\143\"' 'hi.c'\n-\n-#\n-# Valid paths before a space: filecopy (source) and filerename (source).\n-#\n-# commit :301 from root -- modify $path (for setup)\n-# commit :302 from :301 -- copy $path hello2.c\n-# commit :303 from :301 -- rename $path hello2.c\n-#\n-test_path_space_success () {\n-\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths before space with $test must work\" '\n-\t\ttest_when_finished \"git branch -D S-path-space\" &&\n-\n-\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF 2>err &&\n-\t\tblob\n-\t\tmark :401\n-\t\tdata <<BLOB\n-\t\thello world\n-\t\tBLOB\n-\n-\t\tcommit refs/heads/S-path-space\n-\t\tmark :301\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tinitial commit\n-\t\tCOMMIT\n-\t\tM 100644 :401 $path\n-\n-\t\tcommit refs/heads/S-path-space\n-\t\tmark :302\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filecopy source\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tC $path hello2.c\n-\n-\t\tcommit refs/heads/S-path-space\n-\t\tmark :303\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit filerename source\n-\t\tCOMMIT\n-\t\tfrom :301\n-\t\tR $path hello2.c\n-\n-\t\tEOF\n-\n-\t\tcommit_c=$(grep :302 marks.out | cut -d\\  -f2) &&\n-\t\tcommit_r=$(grep :303 marks.out | cut -d\\  -f2) &&\n-\t\tblob=$(grep :401 marks.out | cut -d\\  -f2) &&\n-\n-\t\t(\n-\t\t\tprintf \"100644 blob $blob\\t$unquoted_path\\n\" &&\n-\t\t\tprintf \"100644 blob $blob\\thello2.c\\n\"\n-\t\t) | sort >tree_c.exp &&\n-\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n-\t\ttest_cmp tree_c.exp tree_c.out &&\n-\n-\t\tprintf \"100644 blob $blob\\thello2.c\\n\" >tree_r.exp &&\n-\t\tgit ls-tree $commit_r >tree_r.out &&\n-\t\ttest_cmp tree_r.exp tree_r.out\n-\t'\n-}\n-\n-test_path_space_success 'quoted spaces'      '\" hello world.c \"'  ' hello world.c '\n-test_path_space_success 'no unquoted spaces' 'hello_world.c'      'hello_world.c'\n-test_path_space_success 'octal escapes'      '\"\\150\\151\\056\\143\"' 'hi.c'\n-\n-#\n-# Test a single commit change with an invalid path. Run it with all occurrences\n-# of <path> in the grammar against all error kinds.\n-#\n-test_path_fail () {\n-\tlocal change=\"$1\" what=\"$2\" prefix=\"$3\" path=\"$4\" suffix=\"$5\" err_grep=\"$6\"\n-\ttest_expect_success \"S: $change with $what must fail\" '\n-\t\ttest_must_fail git fast-import <<-EOF 2>err &&\n-\t\tblob\n-\t\tmark :1\n-\t\tdata <<BLOB\n-\t\thello world\n-\t\tBLOB\n-\n-\t\tcommit refs/heads/S-path-fail\n-\t\tmark :2\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit setup\n-\t\tCOMMIT\n-\t\tM 100644 :1 hello.c\n-\n-\t\tcommit refs/heads/S-path-fail\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tdata <<COMMIT\n-\t\tcommit with bad path\n-\t\tCOMMIT\n-\t\tfrom :2\n-\t\t$prefix$path$suffix\n-\t\tEOF\n-\n-\t\ttest_grep \"$err_grep\" err\n-\t'\n-}\n-\n-test_path_base_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\" suffix=\"$4\"\n-\ttest_path_fail \"$change\" 'unclosed \" in '\"$field\"          \"$prefix\" '\"hello.c'    \"$suffix\" \"invalid $field\"\n-\ttest_path_fail \"$change\" \"invalid escape in quoted $field\" \"$prefix\" '\"hello\\xff\"' \"$suffix\" \"invalid $field\"\n-\ttest_path_fail \"$change\" \"escaped NUL in quoted $field\"    \"$prefix\" '\"hello\\000\"' \"$suffix\" \"NUL in $field\"\n-}\n-test_path_eol_quoted_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n-\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ''\n-\ttest_path_fail \"$change\" \"garbage after quoted $field\" \"$prefix\" '\"hello.c\"' 'x' \"garbage after $field\"\n-\ttest_path_fail \"$change\" \"space after quoted $field\"   \"$prefix\" '\"hello.c\"' ' ' \"garbage after $field\"\n-}\n-test_path_eol_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n-\ttest_path_eol_quoted_fail \"$change\" \"$prefix\" \"$field\"\n-}\n-test_path_space_fail () {\n-\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n-\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ' world.c'\n-\ttest_path_fail \"$change\" \"missing space after quoted $field\"   \"$prefix\" '\"hello.c\"' 'x world.c' \"missing space after $field\"\n-\ttest_path_fail \"$change\" \"missing space after unquoted $field\" \"$prefix\" 'hello.c'   ''          \"missing space after $field\"\n-}\n-\n-test_path_eol_fail   filemodify       'M 100644 :1 ' path\n-test_path_eol_fail   filedelete       'D '           path\n-test_path_space_fail filecopy         'C '           source\n-test_path_eol_fail   filecopy         'C hello.c '   dest\n-test_path_space_fail filerename       'R '           source\n-test_path_eol_fail   filerename       'R hello.c '   dest\n-test_path_eol_fail   'ls (in commit)' 'ls :2 '       path\n-\n-# When 'ls' has no <dataref>, the <path> must be quoted.\n-test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n-\n-###\n-### series T (ls)\n-###\n-\n-for root in '\"\"' ''\n-do\n-\ttest_expect_success \"T: ls root ($root) tree\" '\n-\t\ttest_when_finished \"rm -rf repo\" &&\n-\t\tgit init repo &&\n-\t\t(\n-\t\t\tcd repo &&\n-\t\t\ttest_commit one &&\n-\n-\t\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n-\t\t\t040000 tree $(git rev-parse HEAD^{tree})\tZ\n-\t\t\tEOF\n-\t\t\tsha1=$(git rev-parse --verify HEAD) &&\n-\t\t\tgit fast-import <<-EOF >actual &&\n-\t\t\tls $sha1 $root\n-\t\t\tEOF\n-\t\t\ttest_cmp expect actual\n-\t\t)\n-\t'\n-done\n-\n-test_expect_success 'T: delete branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tgit branch to-delete &&\n-\t\tgit fast-import <<-EOF &&\n-\t\treset refs/heads/to-delete\n-\t\tfrom $ZERO_OID\n-\t\tEOF\n-\t\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n-\t)\n-'\n-\n-test_expect_success 'T: empty reset doesnt delete branch' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\ttest_commit one &&\n-\n-\t\tgit branch not-to-delete &&\n-\t\tgit fast-import <<-EOF &&\n-\t\treset refs/heads/not-to-delete\n-\t\tEOF\n-\t\tgit show-ref &&\n-\t\tgit rev-parse --verify refs/heads/not-to-delete\n-\t)\n-'\n \n ###\n ### series U (filedelete)\n@@ -4439,500 +1205,4 @@ do\n \t'\n done\n \n-###\n-### series V (checkpoint)\n-###\n-\n-# The commands in input_file should not produce any output on the file\n-# descriptor set with --cat-blob-fd (or stdout if unspecified).\n-#\n-# To make sure you're observing the side effects of checkpoint *before*\n-# fast-import terminates (and thus writes out its state), check that the\n-# fast-import process is still running using background_import_still_running\n-# *after* evaluating the test conditions.\n-background_import_then_checkpoint () {\n-\toptions=$1\n-\tinput_file=$2\n-\n-\tmkfifo V.input\n-\texec 8<>V.input\n-\trm V.input\n-\n-\tmkfifo V.output\n-\texec 9<>V.output\n-\trm V.output\n-\n-\t(\n-\t\tgit -C repo fast-import $options <&8 >&9 &\n-\t\techo $! >&9\n-\t\twait $!\n-\t\techo >&2 \"background fast-import terminated too early with exit code $?\"\n-\t\t# Un-block the read loop in the main shell process.\n-\t\techo >&9 UNEXPECTED\n-\t) &\n-\tsh_pid=$!\n-\tread fi_pid <&9\n-\t# We don't mind if fast-import has already died by the time the test\n-\t# ends.\n-\ttest_when_finished \"\n-\t\texec 8>&-; exec 9>&-;\n-\t\tkill $sh_pid && wait $sh_pid\n-\t\tkill $fi_pid && wait $fi_pid\n-\t\ttrue\"\n-\n-\t# Start in the background to ensure we adhere strictly to (blocking)\n-\t# pipes writing sequence. We want to assume that the write below could\n-\t# block, e.g. if fast-import blocks writing its own output to &9\n-\t# because there is no reader on &9 yet.\n-\t(\n-\t\tcat \"$input_file\"\n-\t\techo \"checkpoint\"\n-\t\techo \"progress checkpoint\"\n-\t) >&8 &\n-\n-\tlast=$(\n-\t\twhile read output <&9\n-\t\tdo\n-\t\t\tif test \"$output\" = \"progress checkpoint\" || test \"$output\" = \"UNEXPECTED\"\n-\t\t\tthen\n-\t\t\t\techo \"$output\"\n-\t\t\t\tbreak\n-\t\t\telse\n-\t\t\t\t# otherwise ignore cruft\n-\t\t\t\techo >&2 \"cruft: $output\"\n-\t\t\tfi\n-\t\tdone\n-\t)\n-\n-\ttest \"$last\" = \"progress checkpoint\"\n-}\n-\n-background_import_still_running () {\n-\tif ! kill -0 \"$fi_pid\"\n-\tthen\n-\t\techo >&2 \"background fast-import terminated too early\"\n-\t\tfalse\n-\tfi\n-}\n-\n-setup_checkpoint_repo () {\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\ttest_tick &&\n-\tgit -C repo fast-import <<-INPUT_END\n-\tcommit refs/heads/base\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tbase commit\n-\tCOMMIT\n-\tINPUT_END\n-}\n-\n-test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-INPUT_END &&\n-\tprogress foo\n-\tprogress bar\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"\" repo/input &&\n-\tbackground_import_still_running\n-'\n-\n-test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-\\INPUT_END &&\n-\treset refs/heads/V\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"\" repo/input &&\n-\ttest \"$(git -C repo rev-parse --verify V)\" = \"$(git -C repo rev-parse --verify base)\" &&\n-\tbackground_import_still_running\n-'\n-\n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-INPUT_END &&\n-\tcommit refs/heads/V\n-\tmark :1\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n-\n-\t\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify base)\" &&\n-\t\ttest_cmp marks.expected marks.actual\n-\t) &&\n-\tbackground_import_still_running\n-'\n-\n-# Re-create the exact same commit, but on a different branch: no new object is\n-# created in the database, but the refs and marks still need to be updated.\n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n-\tsetup_checkpoint_repo &&\n-\tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n-\tcommit refs/heads/V\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tcat >repo/input <<-INPUT_END &&\n-\tcommit refs/heads/V2\n-\tmark :2\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\tfrom refs/heads/base\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n-\n-\t\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n-\t\ttest_cmp marks.expected marks.actual\n-\t) &&\n-\tbackground_import_still_running\n-'\n-\n-test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n-\tsetup_checkpoint_repo &&\n-\tcat >repo/input <<-INPUT_END &&\n-\ttag Vtag\n-\tfrom refs/heads/base\n-\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata 0\n-\n-\tINPUT_END\n-\n-\tbackground_import_then_checkpoint \"\" repo/input &&\n-\tgit -C repo show-ref -d Vtag &&\n-\tbackground_import_still_running\n-'\n-\n-###\n-### series W (get-mark and empty orphan commits)\n-###\n-\n-w_input () {\n-\tcat <<-W_INPUT_END\n-\tcommit refs/heads/W-branch\n-\tmark :1\n-\tauthor Full Name <user@company.tld> 1000000000 +0100\n-\tcommitter Full Name <user@company.tld> 1000000000 +0100\n-\tdata 27\n-\tIntentionally empty commit\n-\tLFsget-mark :1\n-\tW_INPUT_END\n-}\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tw_input | sed -e s/LFs// | tr L \"\\n\" | git fast-import\n-\t)\n-'\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\tw_input | sed -e s/LFs/L/ | tr L \"\\n\" | git fast-import\n-\t)\n-'\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t# Technically, this should fail as it has too many linefeeds\n-\t\t# according to the grammar in fast-import.txt.  But, for whatever\n-\t\t# reason, it works.  Since using the correct number of newlines\n-\t\t# does not work with older (pre-2.22) versions of git, allow apps\n-\t\t# that used this second-newline workaround to keep working by\n-\t\t# checking it with this test...\n-\t\tw_input | sed -e s/LFs/LL/ | tr L \"\\n\" | git fast-import\n-\t)\n-'\n-\n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\t# ...but do NOT allow more empty lines than that (see previous test).\n-\t\tw_input | sed -e s/LFs/LLL/ | tr L \"\\n\" | test_must_fail git fast-import\n-\t)\n-'\n-\n-###\n-### series X (other new features)\n-###\n-\n-test_expect_success ICONV 'X: handling encoding' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\n-\t\ttest_tick &&\n-\t\tcat >input <<-INPUT_END &&\n-\t\tcommit refs/heads/encoding\n-\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\t\tencoding iso-8859-7\n-\t\tdata <<COMMIT\n-\t\tINPUT_END\n-\n-\t\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n-\n-\t\tgit fast-import <input &&\n-\t\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n-\t\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n-\t)\n-'\n-\n-test_expect_success 'X: replace ref that becomes useless is removed' '\n-\ttest_when_finished \"rm -rf testrepo\" &&\n-\tgit init -qb main testrepo &&\n-\t(\n-\t\tcd testrepo &&\n-\t\ttest_commit test &&\n-\n-\t\ttest_commit msg somename content &&\n-\n-\t\tgit mv somename othername &&\n-\t\tNEW_TREE=$(git write-tree) &&\n-\t\tMSG=\"$(git log -1 --format=%B HEAD)\" &&\n-\t\tNEW_COMMIT=$(git commit-tree -p HEAD^1 -m \"$MSG\" $NEW_TREE) &&\n-\t\tgit replace main $NEW_COMMIT &&\n-\n-\t\techo more >>othername &&\n-\t\tgit add othername &&\n-\t\tgit commit -qm more &&\n-\n-\t\tgit fast-export --all >tmp &&\n-\t\tsed -e s/othername/somename/ tmp >tmp2 &&\n-\t\tgit fast-import --force <tmp2 2>msgs &&\n-\n-\t\ttest_grep \"dropping.*since it would point to itself\" msgs &&\n-\t\tgit show-ref >refs &&\n-\t\ttest_grep ! refs/replace refs\n-\t)\n-'\n-\n-###\n-### series Y (submodules and hash algorithms)\n-###\n-\n-cat >Y-sub-input <<\\Y_INPUT_END\n-blob\n-mark :1\n-data 4\n-foo\n-\n-reset refs/heads/main\n-commit refs/heads/main\n-mark :2\n-author Full Name <user@company.tld> 1000000000 +0100\n-committer Full Name <user@company.tld> 1000000000 +0100\n-data 24\n-Test submodule commit 1\n-M 100644 :1 file\n-\n-blob\n-mark :3\n-data 8\n-foo\n-bar\n-\n-commit refs/heads/main\n-mark :4\n-author Full Name <user@company.tld> 1000000001 +0100\n-committer Full Name <user@company.tld> 1000000001 +0100\n-data 24\n-Test submodule commit 2\n-from :2\n-M 100644 :3 file\n-Y_INPUT_END\n-\n-# Note that the submodule object IDs are intentionally not translated.\n-cat >Y-main-input <<\\Y_INPUT_END\n-blob\n-mark :1\n-data 4\n-foo\n-\n-reset refs/heads/main\n-commit refs/heads/main\n-mark :2\n-author Full Name <user@company.tld> 2000000000 +0100\n-committer Full Name <user@company.tld> 2000000000 +0100\n-data 14\n-Test commit 1\n-M 100644 :1 file\n-\n-blob\n-mark :3\n-data 73\n-[submodule \"sub1\"]\n-\tpath = sub1\n-\turl = https://void.example.com/main.git\n-\n-commit refs/heads/main\n-mark :4\n-author Full Name <user@company.tld> 2000000001 +0100\n-committer Full Name <user@company.tld> 2000000001 +0100\n-data 14\n-Test commit 2\n-from :2\n-M 100644 :3 .gitmodules\n-M 160000 0712c5be7cf681388e355ef47525aaf23aee1a6d sub1\n-\n-blob\n-mark :5\n-data 8\n-foo\n-bar\n-\n-commit refs/heads/main\n-mark :6\n-author Full Name <user@company.tld> 2000000002 +0100\n-committer Full Name <user@company.tld> 2000000002 +0100\n-data 14\n-Test commit 3\n-from :4\n-M 100644 :5 file\n-M 160000 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7 sub1\n-Y_INPUT_END\n-\n-cat >Y-marks <<\\Y_INPUT_END\n-:2 0712c5be7cf681388e355ef47525aaf23aee1a6d\n-:4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n-Y_INPUT_END\n-\n-test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" >input &&\n-\t\ttest_must_fail git fast-import <input 2>err &&\n-\t\ttest_grep \"feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features\" err\n-\t)\n-'\n-\n-test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n-\ttest_when_finished \"rm -rf repo\" &&\n-\tgit init repo &&\n-\t(\n-\t\tcd repo &&\n-\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" >input &&\n-\t\ttest_must_fail git fast-import <input 2>err &&\n-\t\ttest_grep \"feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features\" err\n-\t)\n-'\n-\n-test_expect_success 'Y: rewrite submodules' '\n-\ttest_when_finished \"rm -rf main1\" &&\n-\ttest_oid_cache <<-EOF &&\n-\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n-\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n-\tEOF\n-\n-\tgit init main1 &&\n-\t(\n-\t\tcd main1 &&\n-\t\tgit init sub2 &&\n-\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n-\t\tgit fast-import --rewrite-submodules-from=sub:../Y-marks \\\n-\t\t\t--rewrite-submodules-to=sub:sub2-marks <../Y-main-input &&\n-\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n-\t)\n-'\n-\n-test_expect_success 'Y: reference pending tag or commit' '\n-\ttest_oid_cache <<-EOF &&\n-\tpending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04\n-\tpending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d\n-\tpending_tag sha1:ec6c4db71feb5f66615214dad2324ce030e777a7\n-\tpending_tag sha256:85edc5eac315bc680677b2fc71622bd77476f057eb8dc8ed6a497803a24f1f46\n-\tEOF\n-\n-\ttest_when_finished \"rm -rf reference-pending\" &&\n-\tgit init reference-pending &&\n-\t(\n-\t\tcd reference-pending &&\n-\t\tgit fast-import <<-EOF\n-\t\tcommit refs/heads/main\n-\t\tcommitter A U Thor <author@example.com> 1712563200 +0000\n-\t\tdata 14\n-\t\tcommit message\n-\t\tM 644 inline test file\n-\t\tdata 14\n-\t\tdummy content\n-\n-\t\ttag newtag\n-\t\tfrom $(test_oid pending_commit)\n-\t\ttagger A U Thor <author@example.com> 1712563300 +0000\n-\t\tdata 11\n-\t\ttag message\n-\t\t# no emty line after tag data!\n-\t\treset refs/heads/other\n-\t\tfrom $(test_oid pending_tag)\n-\n-\t\tcommit refs/heads/further\n-\t\tcommitter A U Thor <author@example.com> 1712563400 +0000\n-\t\tdata 21\n-\t\twhat about 2nd commit\n-\t\tfrom $(test_oid pending_commit)\n-\t\tM 644 inline other test file\n-\t\tdata 19\n-\t\tmore dummy content\n-\n-\t\tdone\n-\t\tEOF\n-\t)\n-'\n-\n-test_expect_success 'Y: rewrite submodules via stdin' '\n-\ttest_when_finished \"rm -rf main1\" &&\n-\ttest_oid_cache <<-EOF &&\n-\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n-\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n-\tEOF\n-\n-\tgit init main1 &&\n-\t(\n-\t\tcd main1 &&\n-\t\tgit init sub2 &&\n-\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n-\t\t{\n-\t\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" &&\n-\t\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" &&\n-\t\t\tcat ../Y-main-input\n-\t\t} | git fast-import --allow-unsafe-features &&\n-\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n-\t)\n-'\n-\n test_done\ndiff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh\nindex e62173cf1f..a4b4b0b6cd 100755\n--- a/t/t9301-fast-import-notes.sh\n+++ b/t/t9301-fast-import-notes.sh\n@@ -724,4 +724,404 @@ test_expect_success \"add notes to $num_commits commits in each of $num_notes_ref\n \n '\n \n+setup_notes_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tfile2_data=\"file2\n+second line of EOF\" &&\n+\tfile4_data=abcd &&\n+\tfile4_len=4 &&\n+\tfile5_data=\"an inline file.\n+  we should see it later.\" &&\n+\tfile6_data=\"#!/bin/sh\n+echo \\\"\\$@\\\"\" &&\n+\tnote1_data=\"The first note for the first commit\" &&\n+\tnote2_data=\"The first note for the second commit\" &&\n+\tnote3_data=\"The first note for the third commit\" &&\n+\tnote1b_data=\"The second note for the first commit\" &&\n+\tnote1c_data=\"The third note for the first commit\" &&\n+\tnote2b_data=\"The second note for the second commit\" &&\n+\n+\ttest_tick &&\n+\tcat >repo/input <<-INPUT_END &&\n+\tblob\n+\tmark :2\n+\tdata <<EOF\n+\t$file2_data\n+\tEOF\n+\n+\tcommit refs/heads/notes-test\n+\tmark :3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tfirst (:3)\n+\tCOMMIT\n+\n+\tM 644 :2 file2\n+\n+\tblob\n+\tmark :4\n+\tdata $file4_len\n+\t$file4_data\n+\tcommit refs/heads/notes-test\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tsecond (:5)\n+\tCOMMIT\n+\n+\tM 644 :4 file4\n+\n+\tcommit refs/heads/notes-test\n+\tmark :6\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tthird (:6)\n+\tCOMMIT\n+\n+\tM 644 inline file5\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\n+\tM 755 inline file6\n+\tdata <<EOF\n+\t$file6_data\n+\tEOF\n+\n+\tblob\n+\tmark :7\n+\tdata <<EOF\n+\t$note1_data\n+\tEOF\n+\n+\tblob\n+\tmark :8\n+\tdata <<EOF\n+\t$note2_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :9\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:9)\n+\tCOMMIT\n+\n+\tN :7 :3\n+\tN :8 :5\n+\tN inline :6\n+\tdata <<EOF\n+\t$note3_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :10\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:10)\n+\tCOMMIT\n+\n+\tN inline :3\n+\tdata <<EOF\n+\t$note1b_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar2\n+\tmark :11\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:11)\n+\tCOMMIT\n+\n+\tN inline :3\n+\tdata <<EOF\n+\t$note1c_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :12\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:12)\n+\tCOMMIT\n+\n+\tdeleteall\n+\tN inline :5\n+\tdata <<EOF\n+\t$note2b_data\n+\tEOF\n+\n+\tINPUT_END\n+\n+\tgit -C repo fast-import <repo/input &&\n+\tcommit1=$(git -C repo rev-parse notes-test~2) &&\n+\tcommit2=$(git -C repo rev-parse notes-test^) &&\n+\tcommit3=$(git -C repo rev-parse notes-test)\n+}\n+\n+test_expect_success 'Q: verify first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tfirst (:3)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit1\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tsecond (:5)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $commit2\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tthird (:6)\n+\t\tEOF\n+\t\tgit cat-file commit notes-test | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:9)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for third commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar~2)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:10)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\t100644 blob $commit2\n+\t\t100644 blob $commit3\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second note for first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify first note for third commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note3_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:11)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit1\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify third note for first commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note1c_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify fourth notes commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >expect <<-EOF &&\n+\t\tparent $(git rev-parse --verify refs/notes/foobar^)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tnotes (:12)\n+\t\tEOF\n+\t\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify fourth notes tree' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tsort >expect <<-EOF &&\n+\t\t100644 blob $commit2\n+\t\tEOF\n+\t\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: verify second note for second commit' '\n+\tsetup_notes_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"$note2b_data\" >expect &&\n+\t\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'Q: deny note on empty branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-EOF &&\n+\t\treset refs/heads/Q0\n+\n+\t\tcommit refs/heads/note-Q0\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tNote for an empty branch.\n+\t\tCOMMIT\n+\n+\t\tN inline refs/heads/Q0\n+\t\tdata <<NOTE\n+\t\tsome note\n+\t\tNOTE\n+\t\tEOF\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n test_done\ndiff --git a/t/t9304-fast-import-marks.sh b/t/t9304-fast-import-marks.sh\nindex 6c50adca00..437f9016fa 100755\n--- a/t/t9304-fast-import-marks.sh\n+++ b/t/t9304-fast-import-marks.sh\n@@ -79,4 +79,397 @@ test_expect_success 'relative marks are not affected by subdir' '\n \ttest_path_is_file deep-relative/.git/info/fast-import/exported-marks\n '\n \n+test_expect_success 'R: export-marks feature results in a marks file being created' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature export-marks=git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_grep :1 git.marks\n+\t)\n+'\n+\n+test_expect_success 'R: export-marks options can be overridden by commandline options' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-\\EOF &&\n+\t\tfeature export-marks=feature-sub/git.marks\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\tgit fast-import --allow-unsafe-features \\\n+\t\t\t\t--export-marks=cmdline-sub/other.marks <input &&\n+\t\ttest_grep :1 cmdline-sub/other.marks &&\n+\t\ttest_path_is_missing feature-sub\n+\t)\n+'\n+\n+test_expect_success 'R: catch typo in marks file name' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n+\t\techo \"feature import-marks=nonexistent.marks\" |\n+\t\ttest_must_fail git fast-import --allow-unsafe-features\n+\t)\n+'\n+\n+test_expect_success 'R: import and output marks can be the same file' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n+'\n+\n+test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t)\n+'\n+\n+test_expect_success 'R: --import-marks-if-exists' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n+'\n+\n+test_expect_success 'R: feature import-marks-if-exists' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks &&\n+\n+\t\tblob=$(echo hi | git hash-object -w --stdin) &&\n+\n+\t\techo \":1 $blob\" >io.marks &&\n+\t\techo \":1 $blob\" >expect &&\n+\t\techo \":2 $blob\" >>expect &&\n+\n+\t\tgit fast-import --export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tblob\n+\t\tmark :2\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n+\n+\t\techo \":3 $blob\" >>expect &&\n+\n+\t\tgit fast-import --import-marks=io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=not_io.marks\n+\t\tblob\n+\t\tmark :3\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks &&\n+\n+\t\tgit fast-import --import-marks-if-exists=not_io.marks \\\n+\t\t\t\t--export-marks=io.marks \\\n+\t\t\t\t--allow-unsafe-features <<-\\EOF &&\n+\t\tfeature import-marks-if-exists=io.marks\n+\t\tEOF\n+\t\ttest_must_be_empty io.marks\n+\t)\n+'\n+\n+test_expect_success 'R: corrupt lines do not mess marks file' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f io.marks &&\n+\t\tblob=$(echo hi | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t:3 $ZERO_OID\n+\t\t:1 $blob\n+\t\t:2 $blob\n+\t\tEOF\n+\t\tcp expect io.marks &&\n+\t\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n+\n+\t\tEOF\n+\t\ttest_cmp expect io.marks\n+\t)\n+'\n+\n+create_marks_file () {\n+\tgit fast-import --export-marks=\"$1\" <<-EOF\n+\tblob\n+\tmark :1\n+\tdata 4\n+\tone\n+\n+\tblob\n+\tmark :2\n+\tdata 4\n+\ttwo\n+\n+\tblob\n+\tmark :3\n+\tdata 6\n+\tthree\n+\n+\tblob\n+\tmark :4\n+\tdata 5\n+\tfour\n+\n+\tcommit refs/heads/marks\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit with a mark\n+\tCOMMIT\n+\tM 100644 :1 one\n+\n+\ttag marks-tag\n+\tmark :6\n+\tfrom :5\n+\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<TAG\n+\ttag with a mark\n+\tTAG\n+\n+\tEOF\n+}\n+\n+test_expect_success 'R: import to output marks works without any content' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=marks.out\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n+'\n+\n+test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=marks.new\n+\t\tEOF\n+\n+\t\tgit fast-import --import-marks=marks.out --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out marks.new\n+\t)\n+'\n+\n+test_expect_success 'R: multiple --import-marks= should be honoured' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=nonexistent.marks\n+\t\tfeature export-marks=combined.marks\n+\t\tEOF\n+\n+\t\thead -n2 marks.out >one.marks &&\n+\t\ttail -n +3 marks.out >two.marks &&\n+\t\tgit fast-import --import-marks=one.marks --import-marks=two.marks \\\n+\t\t\t--allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out combined.marks\n+\t)\n+'\n+\n+test_expect_success 'R: feature relative-marks should be honoured' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature export-marks=relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out .git/info/fast-import/relative.out\n+\t)\n+'\n+\n+test_expect_success 'R: feature no-relative-marks should be honoured' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcreate_marks_file marks.out &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature relative-marks\n+\t\tfeature import-marks=relative.in\n+\t\tfeature no-relative-marks\n+\t\tfeature export-marks=non-relative.out\n+\t\tEOF\n+\n+\t\tmkdir -p .git/info/fast-import/ &&\n+\t\tcp marks.out .git/info/fast-import/relative.in &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\ttest_cmp marks.out non-relative.out\n+\t)\n+'\n+\n+test_expect_success 'A: export marks with large values' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_tick &&\n+\t\tmt=$(git hash-object --stdin < /dev/null) &&\n+\t\t>input.blob &&\n+\t\t>marks.exp &&\n+\t\t>tree.exp &&\n+\n+\t\tcat >input.commit <<-EOF &&\n+\t\tcommit refs/heads/verify--dump-marks\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttest the sparse array dumping routines with exponentially growing marks\n+\t\tCOMMIT\n+\t\tEOF\n+\n+\t\ti=0 l=4 m=6 n=7 &&\n+\t\twhile test \"$i\" -lt 27\n+\t\tdo\n+\t\t\tcat >>input.blob <<-EOF &&\n+\t\t\tblob\n+\t\t\tmark :$l\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$m\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$n\n+\t\t\tdata 0\n+\t\t\tEOF\n+\t\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n+\t\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n+\n+\t\t\techo \":$l $mt\" >>marks.exp &&\n+\t\t\techo \":$m $mt\" >>marks.exp &&\n+\t\t\techo \":$n $mt\" >>marks.exp &&\n+\n+\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n+\t\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n+\n+\t\t\tl=$(($l + $l)) &&\n+\t\t\tm=$(($m + $m)) &&\n+\t\t\tn=$(($l + $n)) &&\n+\n+\t\t\ti=$((1 + $i)) || return 1\n+\t\tdone &&\n+\n+\t\tsort tree.exp > tree.exp_s &&\n+\n+\t\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n+\t\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n+\t\ttest_cmp tree.exp_s tree.out &&\n+\t\ttest_cmp marks.exp marks.large\n+\t)\n+'\n+\n test_done\ndiff --git a/t/t9307-fast-import-validation.sh b/t/t9307-fast-import-validation.sh\nnew file mode 100755\nindex 0000000000..e5cb8c6d00\n--- /dev/null\n+++ b/t/t9307-fast-import-validation.sh\n@@ -0,0 +1,1262 @@\n+#!/bin/sh\n+\n+test_description='git fast-import validation'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'B: fail on invalid blob sha1' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit base &&\n+\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/branch\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\t\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit new &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit TEMP_TAG\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\ttag base\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\ttest $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d \" \" ) != \"$ZERO_OID\" &&\n+\t\ttest $(git rev-parse main) = $(git rev-parse TEMP_TAG^)\n+\t)\n+'\n+\n+test_expect_success 'B: accept empty committer' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-1\n+\t\tcommitter  <> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n+'\n+\n+test_expect_success 'B: reject invalid timezone' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: accept invalid timezone with raw-permissive' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-timezone\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import --date-format=raw-permissive <input &&\n+\t\tgit cat-file -p invalid-timezone >out &&\n+\t\ttest_grep \"1234567890 [+]051800\" out\n+\t)\n+'\n+\n+test_expect_success 'B: accept and fixup committer with no name' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/empty-committer-2\n+\t\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tout=$(git fsck) &&\n+\t\techo \"$out\" &&\n+\t\ttest -z \"$out\"\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (1)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (2)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (3)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email>> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (4)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name <email $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid committer (5)' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/invalid-committer\n+\t\tcommitter Name<email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tempty commit\n+\t\tCOMMIT\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of ..' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 ../invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of .' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tGood path\n+\t\tCOMMIT\n+\t\tM 100644 :1 ok-path\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tBad path\n+\t\tCOMMIT\n+\t\tR ok-path ./invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 C:/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of .git' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 100644 :1 .git/invalid-path\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'B: fail on invalid file path of .gitmodules' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<EOF\n+\t\tFile contents\n+\t\tEOF\n+\n+\t\tcommit refs/heads/badpath\n+\t\tcommitter Name <email> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tCommit Message\n+\t\tCOMMIT\n+\t\tM 120000 :1 .gitmodules\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: abort on unsupported feature' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature no-such-feature-exists\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: supported feature is accepted' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: abort on receiving feature after data command' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n+\t\tfeature date-format=now\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: import-marks features forbidden by default' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t>git.marks &&\n+\t\techo \"feature import-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input &&\n+\t\techo \"feature import-marks-if-exists=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: only one import-marks feature allowed per stream' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t>git.marks &&\n+\t\t>git2.marks &&\n+\t\tcat >input <<-EOF &&\n+\t\tfeature import-marks=git.marks\n+\t\tfeature import-marks=git2.marks\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --allow-unsafe-features <input\n+\t)\n+'\n+\n+test_expect_success 'R: export-marks feature forbidden by default' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature export-marks=git.marks\" >input &&\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: feature ls supported' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature ls\" |\n+\t\tgit fast-import\n+\t)\n+'\n+\n+test_expect_success 'R: feature cat-blob supported' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature cat-blob\" |\n+\t\tgit fast-import\n+\t)\n+'\n+\n+test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: die on unknown option' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\toption git non-existing-option\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'R: unknown commandline options are rejected' '\\\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --non-existing-option < /dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: feature-only names are rejected on the command line' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfor opt in --alias --get-mark --ls --notes\n+\t\tdo\n+\t\t\ttest_must_fail git fast-import \"$opt\" </dev/null || return 1\n+\t\tdone\n+\t)\n+'\n+\n+test_expect_success 'R: die on invalid option argument' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"option git active-branches=-5\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\techo \"option git depth=\" |\n+\t\ttest_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: ignore non-git options' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\toption non-existing-vcs non-existing-option\n+\t\tEOF\n+\n+\t\tgit fast-import <input\n+\t)\n+'\n+\n+###\n+### series S (mark and path parsing)\n+###\n+#\n+# Make sure missing spaces and EOLs after mark references\n+# cause errors.\n+#\n+# Setup:\n+#\n+#   1--2--4\n+#    \\   /\n+#     -3-\n+#\n+#   commit marks:  301, 302, 303, 304\n+#   blob marks:              403, 404, resp.\n+#   note mark:          202\n+#\n+# The error message when a space is missing not at the\n+# end of the line is:\n+#\n+#   missing space after ..\n+#\n+# or when extra characters come after the mark at the end\n+# of the line:\n+#\n+#   garbage after ..\n+#\n+# or when the dataref is neither \"inline \" or a known SHA1,\n+#\n+#   invalid dataref ..\n+#\n+setup_marks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_tick &&\n+\n+\tcat >repo/input <<-INPUT_END &&\n+\tcommit refs/heads/S\n+\tmark :301\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit 1\n+\tCOMMIT\n+\tM 100644 inline hello.c\n+\tdata <<BLOB\n+\tblob 1\n+\tBLOB\n+\n+\tcommit refs/heads/S\n+\tmark :302\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcommit 2\n+\tCOMMIT\n+\tfrom :301\n+\tM 100644 inline hello.c\n+\tdata <<BLOB\n+\tblob 2\n+\tBLOB\n+\n+\tblob\n+\tmark :403\n+\tdata <<BLOB\n+\tblob 3\n+\tBLOB\n+\n+\tblob\n+\tmark :202\n+\tdata <<BLOB\n+\tnote 2\n+\tBLOB\n+\tINPUT_END\n+\n+\tgit -C repo fast-import --export-marks=marks <repo/input\n+}\n+\n+#\n+# filemodify, three datarefs\n+#\n+test_expect_success 'S: filemodify with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 :403x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n+'\n+\n+# inline is misspelled; fast-import thinks it is some unknown dataref\n+test_expect_success 'S: filemodify with garbage after inline must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 inlineX hello.c\n+\t\tdata <<BLOB\n+\t\tinline\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n+'\n+\n+test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :403 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit N\n+\t\tCOMMIT\n+\t\tM 100644 ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n+'\n+\n+#\n+# notemodify, three ways to say dataref\n+#\n+test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref markref\n+\t\tCOMMIT\n+\t\tN :202x :302\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n+'\n+\n+test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref inline\n+\t\tCOMMIT\n+\t\tN inlineX :302\n+\t\tdata <<BLOB\n+\t\tnote blob\n+\t\tBLOB\n+\t\tEOF\n+\t\ttest_grep \"nvalid dataref\" err\n+\t)\n+'\n+\n+test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :202 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note dataref sha1\n+\t\tCOMMIT\n+\t\tN ${sha1}x :302\n+\t\tEOF\n+\t\ttest_grep \"space after SHA1\" err\n+\t)\n+'\n+\n+#\n+# notemodify, mark in commit-ish\n+#\n+test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/Snotes\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit S note commit-ish\n+\t\tCOMMIT\n+\t\tN :202 :302x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# from\n+#\n+test_expect_success 'S: from with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail \\\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+\n+#\n+# merge\n+#\n+test_expect_success 'S: merge with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n+\t\tcommit refs/heads/S2\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit 3\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcommit refs/heads/S\n+\t\tmark :304\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tmerge 4\n+\t\tCOMMIT\n+\t\tfrom :302\n+\t\tmerge :303x\n+\t\tM 100644 :403 hello.c\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# tag, from markref\n+#\n+test_expect_success 'S: tag with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\ttag refs/tags/Stag\n+\t\tfrom :302x\n+\t\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<TAG\n+\t\ttag S\n+\t\tTAG\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# cat-blob markref\n+#\n+test_expect_success 'S: cat-blob with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tcat-blob :403x\n+\t\tEOF\n+\t\ttest_grep \"after mark\" err\n+\t)\n+'\n+\n+#\n+# ls markref\n+#\n+test_expect_success 'S: ls with garbage after mark must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls :302x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after mark\" err\n+\t)\n+'\n+\n+test_expect_success 'S: ls with garbage after sha1 must fail' '\n+\tsetup_marks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsha1=$(grep :302 marks | cut -d\\  -f2) &&\n+\t\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n+\t\tls ${sha1}x hello.c\n+\t\tEOF\n+\t\ttest_grep \"space after tree-ish\" err\n+\t)\n+'\n+\n+#\n+# Path parsing\n+#\n+# There are two sorts of ways a path can be parsed, depending on whether it is\n+# the last field on the line. Additionally, ls without a <dataref> has a special\n+# case. Test every occurrence of <path> in the grammar against every error case.\n+# Paths for the root (empty strings) are tested elsewhere.\n+#\n+\n+#\n+# Valid paths at the end of a line: filemodify, filedelete, filecopy (dest),\n+# filerename (dest), and ls.\n+#\n+# commit :301 from root -- modify hello.c (for setup)\n+# commit :302 from :301 -- modify $path\n+# commit :303 from :302 -- delete $path\n+# commit :304 from :301 -- copy hello.c $path\n+# commit :305 from :301 -- rename hello.c $path\n+# ls :305 $path\n+#\n+test_path_eol_success () {\n+\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n+\ttest_expect_success \"S: paths at EOL with $test must work\" '\n+\t\ttest_when_finished \"git branch -D S-path-eol\" &&\n+\n+\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF >out 2>err &&\n+\t\tblob\n+\t\tmark :401\n+\t\tdata <<BLOB\n+\t\thello world\n+\t\tBLOB\n+\n+\t\tblob\n+\t\tmark :402\n+\t\tdata <<BLOB\n+\t\thallo welt\n+\t\tBLOB\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :301\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitial commit\n+\t\tCOMMIT\n+\t\tM 100644 :401 hello.c\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :302\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filemodify\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tM 100644 :402 $path\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filedelete\n+\t\tCOMMIT\n+\t\tfrom :302\n+\t\tD $path\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :304\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filecopy dest\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tC hello.c $path\n+\n+\t\tcommit refs/heads/S-path-eol\n+\t\tmark :305\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filerename dest\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tR hello.c $path\n+\n+\t\tls :305 $path\n+\t\tEOF\n+\n+\t\tcommit_m=$(grep :302 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_d=$(grep :303 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_c=$(grep :304 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_r=$(grep :305 marks.out | cut -d\\  -f2) &&\n+\t\tblob1=$(grep :401 marks.out | cut -d\\  -f2) &&\n+\t\tblob2=$(grep :402 marks.out | cut -d\\  -f2) &&\n+\n+\t\t(\n+\t\t\tprintf \"100644 blob $blob2\\t$unquoted_path\\n\" &&\n+\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n+\t\t) | sort >tree_m.exp &&\n+\t\tgit ls-tree $commit_m | sort >tree_m.out &&\n+\t\ttest_cmp tree_m.exp tree_m.out &&\n+\n+\t\tprintf \"100644 blob $blob1\\thello.c\\n\" >tree_d.exp &&\n+\t\tgit ls-tree $commit_d >tree_d.out &&\n+\t\ttest_cmp tree_d.exp tree_d.out &&\n+\n+\t\t(\n+\t\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" &&\n+\t\t\tprintf \"100644 blob $blob1\\thello.c\\n\"\n+\t\t) | sort >tree_c.exp &&\n+\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n+\t\ttest_cmp tree_c.exp tree_c.out &&\n+\n+\t\tprintf \"100644 blob $blob1\\t$unquoted_path\\n\" >tree_r.exp &&\n+\t\tgit ls-tree $commit_r >tree_r.out &&\n+\t\ttest_cmp tree_r.exp tree_r.out &&\n+\n+\t\ttest_cmp out tree_r.exp\n+\t'\n+}\n+\n+test_path_eol_success 'quoted spaces'   '\" hello world.c \"'  ' hello world.c '\n+test_path_eol_success 'unquoted spaces' ' hello world.c '    ' hello world.c '\n+test_path_eol_success 'octal escapes'   '\"\\150\\151\\056\\143\"' 'hi.c'\n+\n+#\n+# Valid paths before a space: filecopy (source) and filerename (source).\n+#\n+# commit :301 from root -- modify $path (for setup)\n+# commit :302 from :301 -- copy $path hello2.c\n+# commit :303 from :301 -- rename $path hello2.c\n+#\n+test_path_space_success () {\n+\tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n+\ttest_expect_success \"S: paths before space with $test must work\" '\n+\t\ttest_when_finished \"git branch -D S-path-space\" &&\n+\n+\t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF 2>err &&\n+\t\tblob\n+\t\tmark :401\n+\t\tdata <<BLOB\n+\t\thello world\n+\t\tBLOB\n+\n+\t\tcommit refs/heads/S-path-space\n+\t\tmark :301\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitial commit\n+\t\tCOMMIT\n+\t\tM 100644 :401 $path\n+\n+\t\tcommit refs/heads/S-path-space\n+\t\tmark :302\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filecopy source\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tC $path hello2.c\n+\n+\t\tcommit refs/heads/S-path-space\n+\t\tmark :303\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit filerename source\n+\t\tCOMMIT\n+\t\tfrom :301\n+\t\tR $path hello2.c\n+\n+\t\tEOF\n+\n+\t\tcommit_c=$(grep :302 marks.out | cut -d\\  -f2) &&\n+\t\tcommit_r=$(grep :303 marks.out | cut -d\\  -f2) &&\n+\t\tblob=$(grep :401 marks.out | cut -d\\  -f2) &&\n+\n+\t\t(\n+\t\t\tprintf \"100644 blob $blob\\t$unquoted_path\\n\" &&\n+\t\t\tprintf \"100644 blob $blob\\thello2.c\\n\"\n+\t\t) | sort >tree_c.exp &&\n+\t\tgit ls-tree $commit_c | sort >tree_c.out &&\n+\t\ttest_cmp tree_c.exp tree_c.out &&\n+\n+\t\tprintf \"100644 blob $blob\\thello2.c\\n\" >tree_r.exp &&\n+\t\tgit ls-tree $commit_r >tree_r.out &&\n+\t\ttest_cmp tree_r.exp tree_r.out\n+\t'\n+}\n+\n+test_path_space_success 'quoted spaces'      '\" hello world.c \"'  ' hello world.c '\n+test_path_space_success 'no unquoted spaces' 'hello_world.c'      'hello_world.c'\n+test_path_space_success 'octal escapes'      '\"\\150\\151\\056\\143\"' 'hi.c'\n+\n+#\n+# Test a single commit change with an invalid path. Run it with all occurrences\n+# of <path> in the grammar against all error kinds.\n+#\n+test_path_fail () {\n+\tlocal change=\"$1\" what=\"$2\" prefix=\"$3\" path=\"$4\" suffix=\"$5\" err_grep=\"$6\"\n+\ttest_expect_success \"S: $change with $what must fail\" '\n+\t\ttest_must_fail git fast-import <<-EOF 2>err &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB\n+\t\thello world\n+\t\tBLOB\n+\n+\t\tcommit refs/heads/S-path-fail\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit setup\n+\t\tCOMMIT\n+\t\tM 100644 :1 hello.c\n+\n+\t\tcommit refs/heads/S-path-fail\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcommit with bad path\n+\t\tCOMMIT\n+\t\tfrom :2\n+\t\t$prefix$path$suffix\n+\t\tEOF\n+\n+\t\ttest_grep \"$err_grep\" err\n+\t'\n+}\n+\n+test_path_base_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\" suffix=\"$4\"\n+\ttest_path_fail \"$change\" 'unclosed \" in '\"$field\"          \"$prefix\" '\"hello.c'    \"$suffix\" \"invalid $field\"\n+\ttest_path_fail \"$change\" \"invalid escape in quoted $field\" \"$prefix\" '\"hello\\xff\"' \"$suffix\" \"invalid $field\"\n+\ttest_path_fail \"$change\" \"escaped NUL in quoted $field\"    \"$prefix\" '\"hello\\000\"' \"$suffix\" \"NUL in $field\"\n+}\n+test_path_eol_quoted_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n+\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ''\n+\ttest_path_fail \"$change\" \"garbage after quoted $field\" \"$prefix\" '\"hello.c\"' 'x' \"garbage after $field\"\n+\ttest_path_fail \"$change\" \"space after quoted $field\"   \"$prefix\" '\"hello.c\"' ' ' \"garbage after $field\"\n+}\n+test_path_eol_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n+\ttest_path_eol_quoted_fail \"$change\" \"$prefix\" \"$field\"\n+}\n+test_path_space_fail () {\n+\tlocal change=\"$1\" prefix=\"$2\" field=\"$3\"\n+\ttest_path_base_fail \"$change\" \"$prefix\" \"$field\" ' world.c'\n+\ttest_path_fail \"$change\" \"missing space after quoted $field\"   \"$prefix\" '\"hello.c\"' 'x world.c' \"missing space after $field\"\n+\ttest_path_fail \"$change\" \"missing space after unquoted $field\" \"$prefix\" 'hello.c'   ''          \"missing space after $field\"\n+}\n+\n+test_path_eol_fail   filemodify       'M 100644 :1 ' path\n+test_path_eol_fail   filedelete       'D '           path\n+test_path_space_fail filecopy         'C '           source\n+test_path_eol_fail   filecopy         'C hello.c '   dest\n+test_path_space_fail filerename       'R '           source\n+test_path_eol_fail   filerename       'R hello.c '   dest\n+test_path_eol_fail   'ls (in commit)' 'ls :2 '       path\n+\n+# When 'ls' has no <dataref>, the <path> must be quoted.\n+test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n+\n+test_expect_success 'E: rfc2822 date, --date-format=raw' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main^0\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import --date-format=raw <input\n+\t)\n+'\n+\n+test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\t\tdata <<COMMIT\n+\t\tRFC 2822 type date\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main^0\n+\n+\t\tINPUT_END\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --date-format=rfc2822 <input &&\n+\n+\t\tcat >expect <<-EOF &&\n+\t\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n+\n+\t\tRFC 2822 type date\n+\t\tEOF\n+\t\tgit cat-file commit main | sed 1,2d >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n+'\n+\n+test_expect_success 'R: --allow-unsafe-features found after a value' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\tgit fast-import --allow-unsafe-features <input &&\n+\t\tgit fast-import --depth=5 --allow-unsafe-features <input &&\n+\t\tgit fast-import --depth 5 --allow-unsafe-features <input &&\n+\t\tgit fast-import --date-format raw --allow-unsafe-features <input\n+\t)\n+'\n+\n+test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\tGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n+\t\tgit fast-import --allow-unsafe <input\n+\t)\n+'\n+\n+test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \\\n+\t\t\tgit fast-import --allow-unsafe <input 2>err &&\n+\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\t)\n+'\n+\n+test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\ttest_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \\\n+\t\t\tgit fast-import --quiet --export-pack \\\n+\t\t\t--allow-unsafe-features <input 2>err &&\n+\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\t)\n+'\n+\n+test_expect_success 'R: --allow-unsafe-features after a non-option' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"feature import-marks-if-exists=nonexistent.marks\" >input &&\n+\t\ttest_must_fail git fast-import --depth 5 extra \\\n+\t\t\t--allow-unsafe-features <input 2>err &&\n+\t\ttest_grep \"forbidden in input without --allow-unsafe-features\" err\n+\t)\n+'\n+\n+test_done\ndiff --git a/t/t9308-fast-import-stream.sh b/t/t9308-fast-import-stream.sh\nnew file mode 100755\nindex 0000000000..f0755c9673\n--- /dev/null\n+++ b/t/t9308-fast-import-stream.sh\n@@ -0,0 +1,890 @@\n+#!/bin/sh\n+\n+test_description='test fast-import stream handling and output'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'empty stream succeeds' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import </dev/null\n+\t)\n+'\n+\n+test_expect_success 'truncated stream complains' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"tag foo\" | test_must_fail git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print old blob' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 11\n+\t\tyes it can\n+\n+\t\tEOF\n+\t\techo \"cat-blob $blob\" |\n+\t\tgit fast-import --cat-blob-fd=6 6>actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo hello >greeting &&\n+\t\tblob=$(git hash-object -w greeting) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 6\n+\t\thello\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual.3 &&\n+\t\ttest_must_be_empty actual.1 &&\n+\t\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n+\t\toption cat-blob-fd=3\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_must_be_empty actual.3 &&\n+\t\ttest_cmp expect actual.1\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print mark for new blob' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo \"effluentish\" | git hash-object --stdin >expect &&\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\teffluentish\n+\t\tBLOB_END\n+\t\tget-mark :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print new blob' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 12\n+\t\tyep yep yep\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB_END\n+\t\tyep yep yep\n+\t\tBLOB_END\n+\t\tcat-blob :1\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success !MINGW 'R: print new blob by sha1' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t${blob} blob 25\n+\t\ta new blob named by sha1\n+\n+\t\tEOF\n+\t\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n+\t\tblob\n+\t\tdata <<BLOB_END\n+\t\ta new blob named by sha1\n+\t\tBLOB_END\n+\t\tcat-blob $blob\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+setup_big_file () {\n+\t(\n+\t\techo \"the quick brown fox jumps over the lazy dog\" >big &&\n+\t\tfor i in 1 2 3\n+\t\tdo\n+\t\t\tcat big big big big >bigger &&\n+\t\t\tcat bigger bigger bigger bigger >big ||\n+\t\t\texit\n+\t\tdone\n+\t)\n+}\n+\n+test_expect_success 'R: print two blobs to stdout' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsetup_big_file &&\n+\t\tblob1=$(git hash-object big) &&\n+\t\tblob1_len=$(wc -c <big) &&\n+\t\tblob2=$(echo hello | git hash-object --stdin) &&\n+\t\t{\n+\t\t\techo ${blob1} blob $blob1_len &&\n+\t\t\tcat big &&\n+\t\t\tcat <<-EOF\n+\n+\t\t\t${blob2} blob 6\n+\t\t\thello\n+\n+\t\t\tEOF\n+\t\t} >expect &&\n+\t\t{\n+\t\t\tcat <<-\\END_PART1 &&\n+\t\t\t\tblob\n+\t\t\t\tmark :1\n+\t\t\t\tdata <<data_end\n+\t\t\tEND_PART1\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF\n+\t\t\t\tdata_end\n+\t\t\t\tblob\n+\t\t\t\tmark :2\n+\t\t\t\tdata <<data_end\n+\t\t\t\thello\n+\t\t\t\tdata_end\n+\t\t\t\tcat-blob :1\n+\t\t\t\tcat-blob :2\n+\t\t\tEOF\n+\t\t} |\n+\t\tgit fast-import >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success PIPE 'R: copy using cat-file' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tsetup_big_file &&\n+\t\texpect_id=$(git hash-object big) &&\n+\t\texpect_len=$(wc -c <big) &&\n+\t\techo $expect_id blob $expect_len >expect.response &&\n+\n+\t\trm -f blobs &&\n+\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat big &&\n+\t\t\tcat <<-\\EOF &&\n+\t\t\tBLOB\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\techo \"$blob_id $type $size\" >response &&\n+\t\t\ttest_copy_bytes $size >blob <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\tcat <<-EOF &&\n+\t\t\tcommit refs/heads/copied\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tcopy big file as file3\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline file3\n+\t\t\tdata <<BLOB\n+\t\t\tEOF\n+\t\t\tcat blob &&\n+\t\t\techo BLOB\n+\t\t) 3<blobs |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\tgit show copied:file3 >actual &&\n+\t\ttest_cmp expect.response response &&\n+\t\ttest_cmp big actual\n+\t)\n+'\n+\n+test_expect_success PIPE 'R: print blob mid-commit' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _before_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tblob\n+\t\t\tmark :1\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _before_ the commit.\n+\t\t\tBLOB\n+\t\t\tcommit refs/heads/temporary\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tcat-blob :1\n+\t\t\tEOF\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success PIPE 'R: print staged blob within commit' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\trm -f blobs &&\n+\t\techo \"A blob from _within_ the commit.\" >expect &&\n+\t\tmkfifo blobs &&\n+\t\t(\n+\t\t\texec 3<blobs &&\n+\t\t\tcat <<-EOF &&\n+\t\t\tfeature cat-blob\n+\t\t\tcommit refs/heads/within\n+\t\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\t\tdata <<COMMIT\n+\t\t\tEmpty commit\n+\t\t\tCOMMIT\n+\t\t\tM 644 inline within\n+\t\t\tdata <<BLOB\n+\t\t\tA blob from _within_ the commit.\n+\t\t\tBLOB\n+\t\t\tEOF\n+\n+\t\t\tto_get=$(\n+\t\t\t\techo \"A blob from _within_ the commit.\" |\n+\t\t\t\tgit hash-object --stdin\n+\t\t\t) &&\n+\t\t\techo \"cat-blob $to_get\" &&\n+\n+\t\t\tread blob_id type size <&3 &&\n+\t\t\ttest_copy_bytes $size >actual <&3 &&\n+\t\t\tread newline <&3 &&\n+\n+\t\t\techo deleteall\n+\t\t) |\n+\t\tgit fast-import --cat-blob-fd=3 3>blobs &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'R: quiet option results in no stats being output' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-EOF &&\n+\t\toption git quiet\n+\t\tblob\n+\t\tdata 3\n+\t\thi\n+\n+\t\tEOF\n+\n+\t\tgit fast-import 2>output <input &&\n+\t\ttest_must_be_empty output\n+\t)\n+'\n+\n+test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\techo feature done | test_must_fail git fast-import &&\n+\t\ttest_must_fail git fast-import --done </dev/null\n+\t)\n+'\n+\n+test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit fast-import <<-\\EOF &&\n+\t\tfeature done\n+\t\tdone\n+\t\ttrailing gibberish\n+\t\tEOF\n+\t\tgit fast-import <<-\\EOF\n+\t\tdone\n+\t\tmore trailing gibberish\n+\t\tEOF\n+\t)\n+'\n+\n+test_expect_success 'R: terminating \"done\" within commit' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >expect <<-\\EOF &&\n+\t\tOBJID\n+\t\t:000000 100644 OBJID OBJID A\thello.c\n+\t\t:000000 100644 OBJID OBJID A\thello2.c\n+\t\tEOF\n+\t\tgit fast-import <<-EOF &&\n+\t\tcommit refs/heads/done-ends\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<EOT\n+\t\tCommit terminated by \"done\" command\n+\t\tEOT\n+\t\tM 100644 inline hello.c\n+\t\tdata <<EOT\n+\t\tHello, world.\n+\t\tEOT\n+\t\tC hello.c hello2.c\n+\t\tdone\n+\t\tEOF\n+\t\tgit rev-list done-ends |\n+\t\tgit diff-tree -r --stdin --root --always |\n+\t\tsed -e \"s/$OID_REGEX/OBJID/g\" >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+setup_import_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\tgit -C repo config fastimport.unpackLimit 0 &&\n+\tmkdir repo/file2 &&\n+\techo abcd >repo/file2/file4 &&\n+\tgit -C repo add file2/file4 &&\n+\ttest_tick &&\n+\tgit -C repo commit -m base\n+}\n+\n+import_reference_commit () {\n+\tgit fast-import <<-INPUT_END\n+\tcommit refs/heads/$1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tdirty directory copy\n+\tCOMMIT\n+\n+\tfrom refs/heads/main\n+\tM 644 inline file2/file5\n+\tdata <<EOF\n+\tan inline file.\n+\t  we should see it later.\n+\tEOF\n+\n+\tC file2 file3\n+\tD file2/file5\n+\n+\tINPUT_END\n+}\n+\n+test_expect_success 'O: comments are all skipped' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\t#we will\n+\t\tcommit refs/heads/O1\n+\t\t# -- ignore all of this text\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\n+\t\t# do not forget the import blank line!\n+\t\t#\n+\t\t# yes, we started from our usual base of main.\n+\t\t# i like main.\n+\t\tfrom refs/heads/main\n+\t\t# and we need to add file2/file5 to file2.\n+\t\tM 644 inline file2/file5\n+\t\t# otherwise the tree will be different\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\n+\t\t# do not forget to copy file2 to file3\n+\t\tC file2 file3\n+\t\t#\n+\t\t# or to delete file5 from file2.\n+\t\tD file2/file5\n+\t\t# are we done yet?\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O1 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O1-reference &&\n+\t\ttest_cmp_rev O1-reference O1\n+\t)\n+'\n+\n+test_expect_success 'O: blank lines not necessary after data commands' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tdirty directory copy\n+\t\tCOMMIT\n+\t\tfrom refs/heads/main\n+\t\tM 644 inline file2/file5\n+\t\tdata <<EOF\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEOF\n+\t\tC file2 file3\n+\t\tD file2/file5\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tblob4=$(echo abcd | git hash-object --stdin) &&\n+\t\tblob5=$(printf \"an inline file.\\n  we should see it later.\\n\" | git hash-object --stdin) &&\n+\t\tcat >expect <<-EOF &&\n+\t\t100644 blob $blob4\tfile2/file4\n+\t\t100644 blob $blob4\tfile3/file4\n+\t\t100644 blob $blob5\tfile3/file5\n+\t\tEOF\n+\t\tgit ls-tree -r O2 >actual &&\n+\t\ttest_cmp expect actual &&\n+\n+\t\timport_reference_commit O2-reference &&\n+\t\ttest_cmp_rev O2-reference O2\n+\t)\n+'\n+\n+test_expect_success 'O: blank lines not necessary after other commands' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tgit repack -a -d &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tmark :5\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tcheckpoint\n+\t\tcommit refs/heads/O3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\treset refs/tags/O3-2nd\n+\t\tfrom :5\n+\t\treset refs/tags/O3-3rd\n+\t\tfrom :5\n+\t\tINPUT_END\n+\n+\t\tcat >expect <<-INPUT_END &&\n+\t\tstring\n+\t\tof\n+\t\tempty\n+\t\tcommits\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input &&\n+\t\tls -la .git/objects/pack/pack-*.pack >packlist &&\n+\t\tls -la .git/objects/pack/pack-*.pack >idxlist &&\n+\t\ttest_line_count = 4 idxlist &&\n+\t\ttest_line_count = 4 packlist &&\n+\t\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n+\t\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'O: progress outputs as requested by input' '\n+\tsetup_import_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzstring\n+\t\tCOMMIT\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzof\n+\t\tCOMMIT\n+\t\tprogress Two commits down, 2 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzempty\n+\t\tCOMMIT\n+\t\tprogress Three commits down, 1 to go!\n+\t\tcommit refs/heads/O4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tzcommits\n+\t\tCOMMIT\n+\t\tprogress done!\n+\t\tINPUT_END\n+\t\tgit fast-import <input >actual &&\n+\t\tgrep \"progress \" <input >expect &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+##\n+## R: very large blobs\n+##\n+test_expect_success 'R: blob bigger than threshold' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tblobsize=$((2*1024*1024 + 53)) &&\n+\t\ttest-tool genrandom bar $blobsize >expect &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/big-file\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tR - big file\n+\t\tCOMMIT\n+\n+\t\tM 644 inline big1\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\tcat >>input <<-INPUT_END &&\n+\t\tM 644 inline big2\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\t\tcat expect >>input &&\n+\t\techo >>input &&\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --big-file-threshold=1 <input &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack -v \"$p\" || return 1\n+\t\tdone >verify &&\n+\n+\t\tgit cat-file blob big-file:big1 >actual &&\n+\t\ttest_cmp_bin expect actual &&\n+\t\ta=$(git rev-parse big-file:big1) &&\n+\t\tb=$(git rev-parse big-file:big2) &&\n+\t\ttest $a = $b &&\n+\t\tn=$(grep $a verify | wc -l) &&\n+\t\ttest 1 = $n\n+\t)\n+'\n+\n+w_input () {\n+\tcat <<-W_INPUT_END\n+\tcommit refs/heads/W-branch\n+\tmark :1\n+\tauthor Full Name <user@company.tld> 1000000000 +0100\n+\tcommitter Full Name <user@company.tld> 1000000000 +0100\n+\tdata 27\n+\tIntentionally empty commit\n+\tLFsget-mark :1\n+\tW_INPUT_END\n+}\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs// | tr L \"\\n\" | git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tw_input | sed -e s/LFs/L/ | tr L \"\\n\" | git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# Technically, this should fail as it has too many linefeeds\n+\t\t# according to the grammar in fast-import.txt.  But, for whatever\n+\t\t# reason, it works.  Since using the correct number of newlines\n+\t\t# does not work with older (pre-2.22) versions of git, allow apps\n+\t\t# that used this second-newline workaround to keep working by\n+\t\t# checking it with this test...\n+\t\tw_input | sed -e s/LFs/LL/ | tr L \"\\n\" | git fast-import\n+\t)\n+'\n+\n+test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\t# ...but do NOT allow more empty lines than that (see previous test).\n+\t\tw_input | sed -e s/LFs/LLL/ | tr L \"\\n\" | test_must_fail git fast-import\n+\t)\n+'\n+\n+test_expect_success ICONV 'X: handling encoding' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/encoding\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tencoding iso-8859-7\n+\t\tdata <<COMMIT\n+\t\tINPUT_END\n+\n+\t\tprintf \"Pi: \\360\\nCOMMIT\\n\" >>input &&\n+\n+\t\tgit fast-import <input &&\n+\t\tgit cat-file -p encoding | grep $(printf \"\\360\") &&\n+\t\tgit log -1 --format=%B encoding | grep $(printf \"\\317\\200\")\n+\t)\n+'\n+\n+test_expect_success 'X: replace ref that becomes useless is removed' '\n+\ttest_when_finished \"rm -rf testrepo\" &&\n+\tgit init -qb main testrepo &&\n+\t(\n+\t\tcd testrepo &&\n+\t\ttest_commit test &&\n+\n+\t\ttest_commit msg somename content &&\n+\n+\t\tgit mv somename othername &&\n+\t\tNEW_TREE=$(git write-tree) &&\n+\t\tMSG=\"$(git log -1 --format=%B HEAD)\" &&\n+\t\tNEW_COMMIT=$(git commit-tree -p HEAD^1 -m \"$MSG\" $NEW_TREE) &&\n+\t\tgit replace main $NEW_COMMIT &&\n+\n+\t\techo more >>othername &&\n+\t\tgit add othername &&\n+\t\tgit commit -qm more &&\n+\n+\t\tgit fast-export --all >tmp &&\n+\t\tsed -e s/othername/somename/ tmp >tmp2 &&\n+\t\tgit fast-import --force <tmp2 2>msgs &&\n+\n+\t\ttest_grep \"dropping.*since it would point to itself\" msgs &&\n+\t\tgit show-ref >refs &&\n+\t\ttest_grep ! refs/replace refs\n+\t)\n+'\n+\n+for root in '\"\"' ''\n+do\n+\ttest_expect_success \"T: ls root ($root) tree\" '\n+\t\ttest_when_finished \"rm -rf repo\" &&\n+\t\tgit init repo &&\n+\t\t(\n+\t\t\tcd repo &&\n+\t\t\ttest_commit one &&\n+\n+\t\t\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n+\t\t\t040000 tree $(git rev-parse HEAD^{tree})\tZ\n+\t\t\tEOF\n+\t\t\tsha1=$(git rev-parse --verify HEAD) &&\n+\t\t\tgit fast-import <<-EOF >actual &&\n+\t\t\tls $sha1 $root\n+\t\t\tEOF\n+\t\t\ttest_cmp expect actual\n+\t\t)\n+\t'\n+done\n+\n+test_expect_success 'I: export-pack-edges' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init -b main repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/export-boundary\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\twe have a border.  its only 40 characters wide.\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n+\t\t\t--export-pack-edges=edges.list <input &&\n+\n+\t\t# verify edge list\n+\t\tcat >expect <<-EOF &&\n+\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n+\t\tEOF\n+\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'I: export-pack-edges option forbidden by default' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"option git export-pack-edges=edges.list\" >input &&\n+\t\ttest_must_fail git fast-import <input 2>err &&\n+\t\ttest_grep \"option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features\" err\n+\t)\n+'\n+\n+test_expect_success 'I: export-pack-edges via stdin' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init -b main repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\toption git export-pack-edges=edges.list\n+\t\tcommit refs/heads/export-boundary\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tone more similar commit\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\n+\t\tgit -c fastimport.unpackLimit=0 fast-import \\\n+\t\t\t--allow-unsafe-features <input &&\n+\t\tcat >expect <<-EOF &&\n+\t\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n+\t\tEOF\n+\t\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'R: --git-completion-helper does not read from stdin' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n+\t\techo garbage | git fast-import --git-completion-helper >out &&\n+\t\ttest_grep -e \"--date-format=\" out &&\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n+\t\ttest_cmp before after\n+\t)\n+'\n+\n+test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >before &&\n+\t\techo garbage | git fast-import --git-completion-helper-all >all &&\n+\t\ttest_grep -e \"--allow-unsafe-features\" all &&\n+\t\tfind .git/objects/pack -name \"tmp_pack_*\" >after &&\n+\t\ttest_cmp before after\n+\t)\n+'\n+\n+test_done\ndiff --git a/t/t9309-fast-import-checkpoint.sh b/t/t9309-fast-import-checkpoint.sh\nnew file mode 100755\nindex 0000000000..64674dcf83\n--- /dev/null\n+++ b/t/t9309-fast-import-checkpoint.sh\n@@ -0,0 +1,188 @@\n+#!/bin/sh\n+\n+test_description='test fast-import checkpoint handling'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+# The commands in input_file should not produce any output on the file\n+# descriptor set with --cat-blob-fd (or stdout if unspecified).\n+#\n+# To make sure you're observing the side effects of checkpoint *before*\n+# fast-import terminates (and thus writes out its state), check that the\n+# fast-import process is still running using background_import_still_running\n+# *after* evaluating the test conditions.\n+background_import_then_checkpoint () {\n+\toptions=$1\n+\tinput_file=$2\n+\n+\tmkfifo V.input\n+\texec 8<>V.input\n+\trm V.input\n+\n+\tmkfifo V.output\n+\texec 9<>V.output\n+\trm V.output\n+\n+\t(\n+\t\tgit -C repo fast-import $options <&8 >&9 &\n+\t\techo $! >&9\n+\t\twait $!\n+\t\techo >&2 \"background fast-import terminated too early with exit code $?\"\n+\t\t# Un-block the read loop in the main shell process.\n+\t\techo >&9 UNEXPECTED\n+\t) &\n+\tsh_pid=$!\n+\tread fi_pid <&9\n+\t# We don't mind if fast-import has already died by the time the test\n+\t# ends.\n+\ttest_when_finished \"\n+\t\texec 8>&-; exec 9>&-;\n+\t\tkill $sh_pid && wait $sh_pid\n+\t\tkill $fi_pid && wait $fi_pid\n+\t\ttrue\"\n+\n+\t# Start in the background to ensure we adhere strictly to (blocking)\n+\t# pipes writing sequence. We want to assume that the write below could\n+\t# block, e.g. if fast-import blocks writing its own output to &9\n+\t# because there is no reader on &9 yet.\n+\t(\n+\t\tcat \"$input_file\"\n+\t\techo \"checkpoint\"\n+\t\techo \"progress checkpoint\"\n+\t) >&8 &\n+\n+\tlast=$(\n+\t\twhile read output <&9\n+\t\tdo\n+\t\t\tif test \"$output\" = \"progress checkpoint\" || test \"$output\" = \"UNEXPECTED\"\n+\t\t\tthen\n+\t\t\t\techo \"$output\"\n+\t\t\t\tbreak\n+\t\t\telse\n+\t\t\t\t# otherwise ignore cruft\n+\t\t\t\techo >&2 \"cruft: $output\"\n+\t\t\tfi\n+\t\tdone\n+\t)\n+\n+\ttest \"$last\" = \"progress checkpoint\"\n+}\n+\n+background_import_still_running () {\n+\tif ! kill -0 \"$fi_pid\"\n+\tthen\n+\t\techo >&2 \"background fast-import terminated too early\"\n+\t\tfalse\n+\tfi\n+}\n+\n+setup_checkpoint_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_tick &&\n+\tgit -C repo fast-import <<-INPUT_END\n+\tcommit refs/heads/base\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tbase commit\n+\tCOMMIT\n+\tINPUT_END\n+}\n+\n+test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n+\tprogress foo\n+\tprogress bar\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\tbackground_import_still_running\n+'\n+\n+test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-\\INPUT_END &&\n+\treset refs/heads/V\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\ttest \"$(git -C repo rev-parse --verify V)\" = \"$(git -C repo rev-parse --verify base)\" &&\n+\tbackground_import_still_running\n+'\n+\n+test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n+\tcommit refs/heads/V\n+\tmark :1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":1 $(git rev-parse --verify V)\" >marks.expected &&\n+\n+\t\ttest \"$(git rev-parse --verify V^)\" = \"$(git rev-parse --verify base)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n+\tbackground_import_still_running\n+'\n+\n+# Re-create the exact same commit, but on a different branch: no new object is\n+# created in the database, but the refs and marks still need to be updated.\n+test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n+\tsetup_checkpoint_repo &&\n+\tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n+\tcommit refs/heads/V\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tcat >repo/input <<-INPUT_END &&\n+\tcommit refs/heads/V2\n+\tmark :2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\tfrom refs/heads/base\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"--export-marks=marks.actual\" repo/input &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \":2 $(git rev-parse --verify V2)\" >marks.expected &&\n+\n+\t\ttest \"$(git rev-parse --verify V2)\" = \"$(git rev-parse --verify V)\" &&\n+\t\ttest_cmp marks.expected marks.actual\n+\t) &&\n+\tbackground_import_still_running\n+'\n+\n+test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n+\tsetup_checkpoint_repo &&\n+\tcat >repo/input <<-INPUT_END &&\n+\ttag Vtag\n+\tfrom refs/heads/base\n+\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 0\n+\n+\tINPUT_END\n+\n+\tbackground_import_then_checkpoint \"\" repo/input &&\n+\tgit -C repo show-ref -d Vtag &&\n+\tbackground_import_still_running\n+'\n+\n+test_done\ndiff --git a/t/t9310-fast-import-submodule.sh b/t/t9310-fast-import-submodule.sh\nnew file mode 100755\nindex 0000000000..74c20d39c5\n--- /dev/null\n+++ b/t/t9310-fast-import-submodule.sh\n@@ -0,0 +1,385 @@\n+#!/bin/sh\n+\n+test_description='test fast-import with submodules and gitlinks'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+setup_gitlinks_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo base &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata 10\n+\t\ttest file\n+\n+\t\treset refs/heads/sub\n+\t\tcommit refs/heads/sub\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 12\n+\t\tsub_initial\n+\t\tM 100644 :1 file\n+\n+\t\tblob\n+\t\tmark :3\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :4\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :3 .gitmodules\n+\t\tM 160000 :2 sub\n+\n+\t\tblob\n+\t\tmark :5\n+\t\tdata 20\n+\t\ttest file\n+\t\tmore data\n+\n+\t\tcommit refs/heads/sub\n+\t\tmark :6\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 11\n+\t\tsub_second\n+\t\tfrom :2\n+\t\tM 100644 :5 file\n+\n+\t\tcommit refs/heads/subuse1\n+\t\tmark :7\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :4\n+\t\tM 160000 :6 sub\n+\n+\t\tINPUT_END\n+\n+\t\tgit fast-import <input\n+\t)\n+}\n+\n+test_expect_success 'P: superproject & submodule mix' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tgit checkout subuse1 &&\n+\t\trm -rf sub &&\n+\t\tmkdir sub &&\n+\t\t(\n+\t\t\tcd sub &&\n+\t\t\tgit init &&\n+\t\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/main &&\n+\t\t\tgit checkout main\n+\t\t) &&\n+\t\tgit submodule init &&\n+\t\tgit submodule update\n+\t)\n+'\n+\n+test_expect_success 'P: verbatim SHA gitlinks' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tSUBLAST=$(git rev-parse --verify sub) &&\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATAEND\n+\t\t[submodule \"sub\"]\n+\t\t\tpath = sub\n+\t\t\turl = \"$(pwd)/sub\"\n+\t\tDATAEND\n+\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 8\n+\t\tinitial\n+\t\tfrom refs/heads/main\n+\t\tM 100644 :1 .gitmodules\n+\t\tM 160000 $SUBPREV sub\n+\n+\t\tcommit refs/heads/subuse2\n+\t\tmark :3\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata 7\n+\t\tsecond\n+\t\tfrom :2\n+\t\tM 160000 $SUBLAST sub\n+\n+\t\tINPUT_END\n+\n+\t\tgit branch -D sub &&\n+\t\tgit gc --prune=now &&\n+\t\tgit fast-import <input &&\n+\t\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n+\t)\n+'\n+\n+test_expect_success 'P: fail on inline gitlink' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :1\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 inline sub\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'P: fail on blob mark in gitlink' '\n+\tsetup_gitlinks_repo &&\n+\t(\n+\t\tcd repo &&\n+\n+\t\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<DATA\n+\t\t$SUBPREV\n+\t\tDATA\n+\n+\t\tcommit refs/heads/subuse3\n+\t\tmark :2\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcorrupt\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/subuse1\n+\t\tM 160000 :1 sub\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+cat >Y-sub-input <<\\Y_INPUT_END\n+blob\n+mark :1\n+data 4\n+foo\n+\n+reset refs/heads/main\n+commit refs/heads/main\n+mark :2\n+author Full Name <user@company.tld> 1000000000 +0100\n+committer Full Name <user@company.tld> 1000000000 +0100\n+data 24\n+Test submodule commit 1\n+M 100644 :1 file\n+\n+blob\n+mark :3\n+data 8\n+foo\n+bar\n+\n+commit refs/heads/main\n+mark :4\n+author Full Name <user@company.tld> 1000000001 +0100\n+committer Full Name <user@company.tld> 1000000001 +0100\n+data 24\n+Test submodule commit 2\n+from :2\n+M 100644 :3 file\n+Y_INPUT_END\n+\n+# Note that the submodule object IDs are intentionally not translated.\n+cat >Y-main-input <<\\Y_INPUT_END\n+blob\n+mark :1\n+data 4\n+foo\n+\n+reset refs/heads/main\n+commit refs/heads/main\n+mark :2\n+author Full Name <user@company.tld> 2000000000 +0100\n+committer Full Name <user@company.tld> 2000000000 +0100\n+data 14\n+Test commit 1\n+M 100644 :1 file\n+\n+blob\n+mark :3\n+data 73\n+[submodule \"sub1\"]\n+\tpath = sub1\n+\turl = https://void.example.com/main.git\n+\n+commit refs/heads/main\n+mark :4\n+author Full Name <user@company.tld> 2000000001 +0100\n+committer Full Name <user@company.tld> 2000000001 +0100\n+data 14\n+Test commit 2\n+from :2\n+M 100644 :3 .gitmodules\n+M 160000 0712c5be7cf681388e355ef47525aaf23aee1a6d sub1\n+\n+blob\n+mark :5\n+data 8\n+foo\n+bar\n+\n+commit refs/heads/main\n+mark :6\n+author Full Name <user@company.tld> 2000000002 +0100\n+committer Full Name <user@company.tld> 2000000002 +0100\n+data 14\n+Test commit 3\n+from :4\n+M 100644 :5 file\n+M 160000 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7 sub1\n+Y_INPUT_END\n+\n+cat >Y-marks <<\\Y_INPUT_END\n+:2 0712c5be7cf681388e355ef47525aaf23aee1a6d\n+:4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n+Y_INPUT_END\n+\n+test_expect_success 'Y: rewrite submodules' '\n+\ttest_when_finished \"rm -rf main1\" &&\n+\ttest_oid_cache <<-EOF &&\n+\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n+\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n+\tEOF\n+\n+\tgit init main1 &&\n+\t(\n+\t\tcd main1 &&\n+\t\tgit init sub2 &&\n+\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n+\t\tgit fast-import --rewrite-submodules-from=sub:../Y-marks \\\n+\t\t\t--rewrite-submodules-to=sub:sub2-marks <../Y-main-input &&\n+\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n+\t)\n+'\n+\n+test_expect_success 'Y: reference pending tag or commit' '\n+\ttest_oid_cache <<-EOF &&\n+\tpending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04\n+\tpending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d\n+\tpending_tag sha1:ec6c4db71feb5f66615214dad2324ce030e777a7\n+\tpending_tag sha256:85edc5eac315bc680677b2fc71622bd77476f057eb8dc8ed6a497803a24f1f46\n+\tEOF\n+\n+\ttest_when_finished \"rm -rf reference-pending\" &&\n+\tgit init reference-pending &&\n+\t(\n+\t\tcd reference-pending &&\n+\t\tgit fast-import <<-EOF\n+\t\tcommit refs/heads/main\n+\t\tcommitter A U Thor <author@example.com> 1712563200 +0000\n+\t\tdata 14\n+\t\tcommit message\n+\t\tM 644 inline test file\n+\t\tdata 14\n+\t\tdummy content\n+\n+\t\ttag newtag\n+\t\tfrom $(test_oid pending_commit)\n+\t\ttagger A U Thor <author@example.com> 1712563300 +0000\n+\t\tdata 11\n+\t\ttag message\n+\t\t# no emty line after tag data!\n+\t\treset refs/heads/other\n+\t\tfrom $(test_oid pending_tag)\n+\n+\t\tcommit refs/heads/further\n+\t\tcommitter A U Thor <author@example.com> 1712563400 +0000\n+\t\tdata 21\n+\t\twhat about 2nd commit\n+\t\tfrom $(test_oid pending_commit)\n+\t\tM 644 inline other test file\n+\t\tdata 19\n+\t\tmore dummy content\n+\n+\t\tdone\n+\t\tEOF\n+\t)\n+'\n+\n+test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" >input &&\n+\t\ttest_must_fail git fast-import <input 2>err &&\n+\t\ttest_grep \"feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features\" err\n+\t)\n+'\n+\n+test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" >input &&\n+\t\ttest_must_fail git fast-import <input 2>err &&\n+\t\ttest_grep \"feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features\" err\n+\t)\n+'\n+\n+test_expect_success 'Y: rewrite submodules via stdin' '\n+\ttest_when_finished \"rm -rf main1\" &&\n+\ttest_oid_cache <<-EOF &&\n+\tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n+\tYmain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3\n+\tEOF\n+\n+\tgit init main1 &&\n+\t(\n+\t\tcd main1 &&\n+\t\tgit init sub2 &&\n+\t\tgit -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input &&\n+\t\t{\n+\t\t\techo \"feature rewrite-submodules-to=sub:sub2-marks\" &&\n+\t\t\techo \"feature rewrite-submodules-from=sub:../Y-marks\" &&\n+\t\t\tcat ../Y-main-input\n+\t\t} | git fast-import --allow-unsafe-features &&\n+\t\ttest \"$(git rev-parse main)\" = \"$(test_oid Ymain)\"\n+\t)\n+'\n+\n+test_done\ndiff --git a/t/t9311-fast-import-refs.sh b/t/t9311-fast-import-refs.sh\nnew file mode 100755\nindex 0000000000..2bb8ac1d46\n--- /dev/null\n+++ b/t/t9311-fast-import-refs.sh\n@@ -0,0 +1,194 @@\n+#!/bin/sh\n+\n+test_description='test fast-import ref updates'\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+setup_two_commit_repo () {\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\ttest_commit -C repo one &&\n+\ttest_commit -C repo two\n+}\n+\n+test_expect_success 'F: non-fast-forward update skips' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main~1\n+\n+\t\treset refs/heads/other\n+\t\tfrom refs/heads/main\n+\n+\t\tINPUT_END\n+\n+\t\ttest_must_fail git -c fastimport.unpackLimit=0 fast-import <input &&\n+\t\t# branch must remain unaffected\n+\t\ttest $old_branch = $(git rev-parse --verify main^0) &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone &&\n+\n+\t\tcat >expect <<-EOF &&\n+\t\ttree $(git rev-parse main~1^{tree})\n+\t\tparent $(git rev-parse main~1)\n+\t\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\t\tlosing things already?\n+\t\tEOF\n+\t\tgit cat-file commit other >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'G: non-fast-forward update forced' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\told_branch=$(git rev-parse --verify main^0) &&\n+\t\ttest_tick &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/main\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tlosing things already?\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main~1\n+\n+\t\tINPUT_END\n+\t\tgit -c fastimport.unpackLimit=0 fast-import --force <input &&\n+\t\t# branch changed, but logged\n+\t\ttest $old_branch != $(git rev-parse --verify main^0) &&\n+\t\ttest $old_branch = $(git rev-parse --verify main@{1}) &&\n+\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack \"$p\" || return 1\n+\t\tdone\n+\t)\n+'\n+\n+test_expect_success 'J: reset existing branch creates empty commit' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate J\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\treset refs/heads/J\n+\n+\t\tcommit refs/heads/J\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tinitialize J\n+\t\tCOMMIT\n+\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# branch has 1 commit, empty tree\n+\t\ttest 1 = $(git rev-list J | wc -l) &&\n+\t\ttest 0 = $(git ls-tree J | wc -l)\n+\t)\n+'\n+\n+test_expect_success 'J: tag must fail on empty branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\treset refs/heads/J2\n+\n+\t\ttag wrong_tag\n+\t\tfrom refs/heads/J2\n+\t\tdata <<EOF\n+\t\tTag branch that was reset.\n+\t\tEOF\n+\t\tINPUT_END\n+\t\ttest_must_fail git fast-import <input\n+\t)\n+'\n+\n+test_expect_success 'K: reinit branch with from' '\n+\tsetup_two_commit_repo &&\n+\t(\n+\t\tcd repo &&\n+\t\tcat >input <<-INPUT_END &&\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcreate K\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main\n+\n+\t\tcommit refs/heads/K\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tredo K\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/main^1\n+\n+\t\tINPUT_END\n+\t\tgit fast-import <input &&\n+\t\t# K^1 = main^1\n+\t\ttest $(git rev-parse --verify main^1) \\\n+\t\t\t= $(git rev-parse --verify K^1)\n+\t)\n+'\n+\n+test_expect_success 'T: delete branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/to-delete\n+\t\tfrom $ZERO_OID\n+\t\tEOF\n+\t\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n+\t)\n+'\n+\n+test_expect_success 'T: empty reset doesnt delete branch' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit init repo &&\n+\t(\n+\t\tcd repo &&\n+\t\ttest_commit one &&\n+\n+\t\tgit branch not-to-delete &&\n+\t\tgit fast-import <<-EOF &&\n+\t\treset refs/heads/not-to-delete\n+\t\tEOF\n+\t\tgit show-ref &&\n+\t\tgit rev-parse --verify refs/heads/not-to-delete\n+\t)\n+'\n+\n+test_done\n\n-- \n2.56.GIT\n\n\n"},{"id":"558323","messageId":"20261112-kn-fast-import-tests-1-v2-20-b8c3a0ab27e8@gmail.com","threadId":"66819","inReplyTo":"20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com","subject":"[PATCH v2 20/20] t93xx: drop the series letter from the moved test names","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-12T17:34:20Z","receivedAt":"2026-11-12T17:34:20Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"In the previous commits, tests were moved from t9300 to other test\nfiles as is. Each of these tests have their descriptions prefixed with\ntheir series names. Since they don't hold any value outside of t9300,\ndrop them.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t9301-fast-import-notes.sh      |  40 +++++++-------\n t/t9304-fast-import-marks.sh      |  28 +++++-----\n t/t9307-fast-import-validation.sh | 106 +++++++++++++++++++-------------------\n t/t9308-fast-import-stream.sh     |  60 ++++++++++-----------\n t/t9309-fast-import-checkpoint.sh |  10 ++--\n t/t9310-fast-import-submodule.sh  |  18 +++----\n t/t9311-fast-import-refs.sh       |  14 ++---\n 7 files changed, 138 insertions(+), 138 deletions(-)\n\ndiff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh\nindex a4b4b0b6cd..f268b4f0c0 100755\n--- a/t/t9301-fast-import-notes.sh\n+++ b/t/t9301-fast-import-notes.sh\n@@ -860,7 +860,7 @@ echo \\\"\\$@\\\"\" &&\n \tcommit3=$(git -C repo rev-parse notes-test)\n }\n \n-test_expect_success 'Q: verify first commit' '\n+test_expect_success 'verify first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -875,7 +875,7 @@ test_expect_success 'Q: verify first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify second commit' '\n+test_expect_success 'verify second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -891,7 +891,7 @@ test_expect_success 'Q: verify second commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify third commit' '\n+test_expect_success 'verify third commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -907,7 +907,7 @@ test_expect_success 'Q: verify third commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first notes commit' '\n+test_expect_success 'verify first notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -922,7 +922,7 @@ test_expect_success 'Q: verify first notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first notes tree' '\n+test_expect_success 'verify first notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -936,7 +936,7 @@ test_expect_success 'Q: verify first notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for first commit' '\n+test_expect_success 'verify first note for first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -946,7 +946,7 @@ test_expect_success 'Q: verify first note for first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for second commit' '\n+test_expect_success 'verify first note for second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -956,7 +956,7 @@ test_expect_success 'Q: verify first note for second commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for third commit' '\n+test_expect_success 'verify first note for third commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -966,7 +966,7 @@ test_expect_success 'Q: verify first note for third commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify second notes commit' '\n+test_expect_success 'verify second notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -982,7 +982,7 @@ test_expect_success 'Q: verify second notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify second notes tree' '\n+test_expect_success 'verify second notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -996,7 +996,7 @@ test_expect_success 'Q: verify second notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify second note for first commit' '\n+test_expect_success 'verify second note for first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1006,7 +1006,7 @@ test_expect_success 'Q: verify second note for first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for second commit' '\n+test_expect_success 'verify first note for second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1016,7 +1016,7 @@ test_expect_success 'Q: verify first note for second commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify first note for third commit' '\n+test_expect_success 'verify first note for third commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1026,7 +1026,7 @@ test_expect_success 'Q: verify first note for third commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify third notes commit' '\n+test_expect_success 'verify third notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1041,7 +1041,7 @@ test_expect_success 'Q: verify third notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify third notes tree' '\n+test_expect_success 'verify third notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1053,7 +1053,7 @@ test_expect_success 'Q: verify third notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify third note for first commit' '\n+test_expect_success 'verify third note for first commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1063,7 +1063,7 @@ test_expect_success 'Q: verify third note for first commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify fourth notes commit' '\n+test_expect_success 'verify fourth notes commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1079,7 +1079,7 @@ test_expect_success 'Q: verify fourth notes commit' '\n \t)\n '\n \n-test_expect_success 'Q: verify fourth notes tree' '\n+test_expect_success 'verify fourth notes tree' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1091,7 +1091,7 @@ test_expect_success 'Q: verify fourth notes tree' '\n \t)\n '\n \n-test_expect_success 'Q: verify second note for second commit' '\n+test_expect_success 'verify second note for second commit' '\n \tsetup_notes_repo &&\n \t(\n \t\tcd repo &&\n@@ -1101,7 +1101,7 @@ test_expect_success 'Q: verify second note for second commit' '\n \t)\n '\n \n-test_expect_success 'Q: deny note on empty branch' '\n+test_expect_success 'deny note on empty branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\ndiff --git a/t/t9304-fast-import-marks.sh b/t/t9304-fast-import-marks.sh\nindex 437f9016fa..57050dcfe4 100755\n--- a/t/t9304-fast-import-marks.sh\n+++ b/t/t9304-fast-import-marks.sh\n@@ -79,7 +79,7 @@ test_expect_success 'relative marks are not affected by subdir' '\n \ttest_path_is_file deep-relative/.git/info/fast-import/exported-marks\n '\n \n-test_expect_success 'R: export-marks feature results in a marks file being created' '\n+test_expect_success 'export-marks feature results in a marks file being created' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -99,7 +99,7 @@ test_expect_success 'R: export-marks feature results in a marks file being creat\n \t)\n '\n \n-test_expect_success 'R: export-marks options can be overridden by commandline options' '\n+test_expect_success 'export-marks options can be overridden by commandline options' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -120,7 +120,7 @@ test_expect_success 'R: export-marks options can be overridden by commandline op\n \t)\n '\n \n-test_expect_success 'R: catch typo in marks file name' '\n+test_expect_success 'catch typo in marks file name' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -132,7 +132,7 @@ test_expect_success 'R: catch typo in marks file name' '\n \t)\n '\n \n-test_expect_success 'R: import and output marks can be the same file' '\n+test_expect_success 'import and output marks can be the same file' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -162,7 +162,7 @@ test_expect_success 'R: import and output marks can be the same file' '\n \t)\n '\n \n-test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '\n+test_expect_success '--import-marks=foo --output-marks=foo to create foo fails' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -179,7 +179,7 @@ test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fail\n \t)\n '\n \n-test_expect_success 'R: --import-marks-if-exists' '\n+test_expect_success '--import-marks-if-exists' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -199,7 +199,7 @@ test_expect_success 'R: --import-marks-if-exists' '\n \t)\n '\n \n-test_expect_success 'R: feature import-marks-if-exists' '\n+test_expect_success 'feature import-marks-if-exists' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -253,7 +253,7 @@ test_expect_success 'R: feature import-marks-if-exists' '\n \t)\n '\n \n-test_expect_success 'R: corrupt lines do not mess marks file' '\n+test_expect_success 'corrupt lines do not mess marks file' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -315,7 +315,7 @@ create_marks_file () {\n \tEOF\n }\n \n-test_expect_success 'R: import to output marks works without any content' '\n+test_expect_success 'import to output marks works without any content' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -332,7 +332,7 @@ test_expect_success 'R: import to output marks works without any content' '\n \t)\n '\n \n-test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n+test_expect_success 'import marks prefers commandline marks file over the stream' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -349,7 +349,7 @@ test_expect_success 'R: import marks prefers commandline marks file over the str\n \t)\n '\n \n-test_expect_success 'R: multiple --import-marks= should be honoured' '\n+test_expect_success 'multiple --import-marks= should be honoured' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -369,7 +369,7 @@ test_expect_success 'R: multiple --import-marks= should be honoured' '\n \t)\n '\n \n-test_expect_success 'R: feature relative-marks should be honoured' '\n+test_expect_success 'feature relative-marks should be honoured' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -389,7 +389,7 @@ test_expect_success 'R: feature relative-marks should be honoured' '\n \t)\n '\n \n-test_expect_success 'R: feature no-relative-marks should be honoured' '\n+test_expect_success 'feature no-relative-marks should be honoured' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -410,7 +410,7 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '\n \t)\n '\n \n-test_expect_success 'A: export marks with large values' '\n+test_expect_success 'export marks with large values' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\ndiff --git a/t/t9307-fast-import-validation.sh b/t/t9307-fast-import-validation.sh\nindex e5cb8c6d00..e9485fed21 100755\n--- a/t/t9307-fast-import-validation.sh\n+++ b/t/t9307-fast-import-validation.sh\n@@ -6,7 +6,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n \n . ./test-lib.sh\n \n-test_expect_success 'B: fail on invalid blob sha1' '\n+test_expect_success 'fail on invalid blob sha1' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -31,7 +31,7 @@ test_expect_success 'B: fail on invalid blob sha1' '\n \t)\n '\n \n-test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n+test_expect_success 'accept branch name \"TEMP_TAG\"' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -55,7 +55,7 @@ test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n \t)\n '\n \n-test_expect_success 'B: accept empty committer' '\n+test_expect_success 'accept empty committer' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -75,7 +75,7 @@ test_expect_success 'B: accept empty committer' '\n \t)\n '\n \n-test_expect_success 'B: reject invalid timezone' '\n+test_expect_success 'reject invalid timezone' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -93,7 +93,7 @@ test_expect_success 'B: reject invalid timezone' '\n \t)\n '\n \n-test_expect_success 'B: accept invalid timezone with raw-permissive' '\n+test_expect_success 'accept invalid timezone with raw-permissive' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -113,7 +113,7 @@ test_expect_success 'B: accept invalid timezone with raw-permissive' '\n \t)\n '\n \n-test_expect_success 'B: accept and fixup committer with no name' '\n+test_expect_success 'accept and fixup committer with no name' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -133,7 +133,7 @@ test_expect_success 'B: accept and fixup committer with no name' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (1)' '\n+test_expect_success 'fail on invalid committer (1)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -151,7 +151,7 @@ test_expect_success 'B: fail on invalid committer (1)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (2)' '\n+test_expect_success 'fail on invalid committer (2)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -169,7 +169,7 @@ test_expect_success 'B: fail on invalid committer (2)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (3)' '\n+test_expect_success 'fail on invalid committer (3)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -187,7 +187,7 @@ test_expect_success 'B: fail on invalid committer (3)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (4)' '\n+test_expect_success 'fail on invalid committer (4)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -205,7 +205,7 @@ test_expect_success 'B: fail on invalid committer (4)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid committer (5)' '\n+test_expect_success 'fail on invalid committer (5)' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -223,7 +223,7 @@ test_expect_success 'B: fail on invalid committer (5)' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of ..' '\n+test_expect_success 'fail on invalid file path of ..' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -248,7 +248,7 @@ test_expect_success 'B: fail on invalid file path of ..' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of .' '\n+test_expect_success 'fail on invalid file path of .' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -280,7 +280,7 @@ test_expect_success 'B: fail on invalid file path of .' '\n \t)\n '\n \n-test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n+test_expect_success WINDOWS 'fail on invalid file path of C:' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -305,7 +305,7 @@ test_expect_success WINDOWS 'B: fail on invalid file path of C:' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of .git' '\n+test_expect_success 'fail on invalid file path of .git' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -330,7 +330,7 @@ test_expect_success 'B: fail on invalid file path of .git' '\n \t)\n '\n \n-test_expect_success 'B: fail on invalid file path of .gitmodules' '\n+test_expect_success 'fail on invalid file path of .gitmodules' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -355,7 +355,7 @@ test_expect_success 'B: fail on invalid file path of .gitmodules' '\n \t)\n '\n \n-test_expect_success 'R: abort on unsupported feature' '\n+test_expect_success 'abort on unsupported feature' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -369,7 +369,7 @@ test_expect_success 'R: abort on unsupported feature' '\n \t)\n '\n \n-test_expect_success 'R: supported feature is accepted' '\n+test_expect_success 'supported feature is accepted' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -383,7 +383,7 @@ test_expect_success 'R: supported feature is accepted' '\n \t)\n '\n \n-test_expect_success 'R: abort on receiving feature after data command' '\n+test_expect_success 'abort on receiving feature after data command' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -400,7 +400,7 @@ test_expect_success 'R: abort on receiving feature after data command' '\n \t)\n '\n \n-test_expect_success 'R: import-marks features forbidden by default' '\n+test_expect_success 'import-marks features forbidden by default' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -414,7 +414,7 @@ test_expect_success 'R: import-marks features forbidden by default' '\n \t)\n '\n \n-test_expect_success 'R: only one import-marks feature allowed per stream' '\n+test_expect_success 'only one import-marks feature allowed per stream' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -431,7 +431,7 @@ test_expect_success 'R: only one import-marks feature allowed per stream' '\n \t)\n '\n \n-test_expect_success 'R: export-marks feature forbidden by default' '\n+test_expect_success 'export-marks feature forbidden by default' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -442,7 +442,7 @@ test_expect_success 'R: export-marks feature forbidden by default' '\n \t)\n '\n \n-test_expect_success 'R: feature ls supported' '\n+test_expect_success 'feature ls supported' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -453,7 +453,7 @@ test_expect_success 'R: feature ls supported' '\n \t)\n '\n \n-test_expect_success 'R: feature cat-blob supported' '\n+test_expect_success 'feature cat-blob supported' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -464,7 +464,7 @@ test_expect_success 'R: feature cat-blob supported' '\n \t)\n '\n \n-test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n+test_expect_success 'cat-blob-fd must be a nonnegative integer' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -474,7 +474,7 @@ test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '\n \t)\n '\n \n-test_expect_success 'R: die on unknown option' '\n+test_expect_success 'die on unknown option' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -488,7 +488,7 @@ test_expect_success 'R: die on unknown option' '\n \t)\n '\n \n-test_expect_success 'R: unknown commandline options are rejected' '\\\n+test_expect_success 'unknown commandline options are rejected' '\\\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -498,7 +498,7 @@ test_expect_success 'R: unknown commandline options are rejected' '\\\n \t)\n '\n \n-test_expect_success 'R: feature-only names are rejected on the command line' '\n+test_expect_success 'feature-only names are rejected on the command line' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -511,7 +511,7 @@ test_expect_success 'R: feature-only names are rejected on the command line' '\n \t)\n '\n \n-test_expect_success 'R: die on invalid option argument' '\n+test_expect_success 'die on invalid option argument' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -525,7 +525,7 @@ test_expect_success 'R: die on invalid option argument' '\n \t)\n '\n \n-test_expect_success 'R: ignore non-git options' '\n+test_expect_success 'ignore non-git options' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -618,7 +618,7 @@ setup_marks_repo () {\n #\n # filemodify, three datarefs\n #\n-test_expect_success 'S: filemodify with garbage after mark must fail' '\n+test_expect_success 'filemodify with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -636,7 +636,7 @@ test_expect_success 'S: filemodify with garbage after mark must fail' '\n '\n \n # inline is misspelled; fast-import thinks it is some unknown dataref\n-test_expect_success 'S: filemodify with garbage after inline must fail' '\n+test_expect_success 'filemodify with garbage after inline must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -656,7 +656,7 @@ test_expect_success 'S: filemodify with garbage after inline must fail' '\n \t)\n '\n \n-test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n+test_expect_success 'filemodify with garbage after sha1 must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -677,7 +677,7 @@ test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n #\n # notemodify, three ways to say dataref\n #\n-test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n+test_expect_success 'notemodify with garbage after mark dataref must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -694,7 +694,7 @@ test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n \t)\n '\n \n-test_expect_success 'S: notemodify with garbage after inline dataref must fail' '\n+test_expect_success 'notemodify with garbage after inline dataref must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -714,7 +714,7 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail'\n \t)\n '\n \n-test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n+test_expect_success 'notemodify with garbage after sha1 dataref must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -735,7 +735,7 @@ test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n #\n # notemodify, mark in commit-ish\n #\n-test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' '\n+test_expect_success 'notemodify with garbage after mark commit-ish must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -755,7 +755,7 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'\n #\n # from\n #\n-test_expect_success 'S: from with garbage after mark must fail' '\n+test_expect_success 'from with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -780,7 +780,7 @@ test_expect_success 'S: from with garbage after mark must fail' '\n #\n # merge\n #\n-test_expect_success 'S: merge with garbage after mark must fail' '\n+test_expect_success 'merge with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -814,7 +814,7 @@ test_expect_success 'S: merge with garbage after mark must fail' '\n #\n # tag, from markref\n #\n-test_expect_success 'S: tag with garbage after mark must fail' '\n+test_expect_success 'tag with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -834,7 +834,7 @@ test_expect_success 'S: tag with garbage after mark must fail' '\n #\n # cat-blob markref\n #\n-test_expect_success 'S: cat-blob with garbage after mark must fail' '\n+test_expect_success 'cat-blob with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -849,7 +849,7 @@ test_expect_success 'S: cat-blob with garbage after mark must fail' '\n #\n # ls markref\n #\n-test_expect_success 'S: ls with garbage after mark must fail' '\n+test_expect_success 'ls with garbage after mark must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -861,7 +861,7 @@ test_expect_success 'S: ls with garbage after mark must fail' '\n \t)\n '\n \n-test_expect_success 'S: ls with garbage after sha1 must fail' '\n+test_expect_success 'ls with garbage after sha1 must fail' '\n \tsetup_marks_repo &&\n \t(\n \t\tcd repo &&\n@@ -896,7 +896,7 @@ test_expect_success 'S: ls with garbage after sha1 must fail' '\n #\n test_path_eol_success () {\n \tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths at EOL with $test must work\" '\n+\ttest_expect_success \"paths at EOL with $test must work\" '\n \t\ttest_when_finished \"git branch -D S-path-eol\" &&\n \n \t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF >out 2>err &&\n@@ -1005,7 +1005,7 @@ test_path_eol_success 'octal escapes'   '\"\\150\\151\\056\\143\"' 'hi.c'\n #\n test_path_space_success () {\n \tlocal test=\"$1\" path=\"$2\" unquoted_path=\"$3\"\n-\ttest_expect_success \"S: paths before space with $test must work\" '\n+\ttest_expect_success \"paths before space with $test must work\" '\n \t\ttest_when_finished \"git branch -D S-path-space\" &&\n \n \t\tgit -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF 2>err &&\n@@ -1070,7 +1070,7 @@ test_path_space_success 'octal escapes'      '\"\\150\\151\\056\\143\"' 'hi.c'\n #\n test_path_fail () {\n \tlocal change=\"$1\" what=\"$2\" prefix=\"$3\" path=\"$4\" suffix=\"$5\" err_grep=\"$6\"\n-\ttest_expect_success \"S: $change with $what must fail\" '\n+\ttest_expect_success \"$change with $what must fail\" '\n \t\ttest_must_fail git fast-import <<-EOF 2>err &&\n \t\tblob\n \t\tmark :1\n@@ -1133,7 +1133,7 @@ test_path_eol_fail   'ls (in commit)' 'ls :2 '       path\n # When 'ls' has no <dataref>, the <path> must be quoted.\n test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path\n \n-test_expect_success 'E: rfc2822 date, --date-format=raw' '\n+test_expect_success 'rfc2822 date, --date-format=raw' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -1156,7 +1156,7 @@ test_expect_success 'E: rfc2822 date, --date-format=raw' '\n \t)\n '\n \n-test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n+test_expect_success 'rfc2822 date, --date-format=rfc2822' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -1193,7 +1193,7 @@ test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n \t)\n '\n \n-test_expect_success 'R: --allow-unsafe-features found after a value' '\n+test_expect_success '--allow-unsafe-features found after a value' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -1207,7 +1207,7 @@ test_expect_success 'R: --allow-unsafe-features found after a value' '\n \t)\n '\n \n-test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n+test_expect_success '--allow-unsafe-features can be abbreviated' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -1219,7 +1219,7 @@ test_expect_success 'R: --allow-unsafe-features can be abbreviated' '\n \t)\n '\n \n-test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n+test_expect_success 'disallowed abbreviation of --allow-unsafe-features' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -1232,7 +1232,7 @@ test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' '\n \t)\n '\n \n-test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' '\n+test_expect_success '--allow-unsafe-features as the value of an abbreviation' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -1246,7 +1246,7 @@ test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation'\n \t)\n '\n \n-test_expect_success 'R: --allow-unsafe-features after a non-option' '\n+test_expect_success '--allow-unsafe-features after a non-option' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\ndiff --git a/t/t9308-fast-import-stream.sh b/t/t9308-fast-import-stream.sh\nindex f0755c9673..8d3cd3c9e6 100755\n--- a/t/t9308-fast-import-stream.sh\n+++ b/t/t9308-fast-import-stream.sh\n@@ -26,7 +26,7 @@ test_expect_success 'truncated stream complains' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print old blob' '\n+test_expect_success !MINGW 'print old blob' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -44,7 +44,7 @@ test_expect_success !MINGW 'R: print old blob' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n+test_expect_success !MINGW 'in-stream cat-blob-fd not respected' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -71,7 +71,7 @@ test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print mark for new blob' '\n+test_expect_success !MINGW 'print mark for new blob' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -90,7 +90,7 @@ test_expect_success !MINGW 'R: print mark for new blob' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print new blob' '\n+test_expect_success !MINGW 'print new blob' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -114,7 +114,7 @@ test_expect_success !MINGW 'R: print new blob' '\n \t)\n '\n \n-test_expect_success !MINGW 'R: print new blob by sha1' '\n+test_expect_success !MINGW 'print new blob by sha1' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -149,7 +149,7 @@ setup_big_file () {\n \t)\n }\n \n-test_expect_success 'R: print two blobs to stdout' '\n+test_expect_success 'print two blobs to stdout' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -192,7 +192,7 @@ test_expect_success 'R: print two blobs to stdout' '\n \t)\n '\n \n-test_expect_success PIPE 'R: copy using cat-file' '\n+test_expect_success PIPE 'copy using cat-file' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -244,7 +244,7 @@ test_expect_success PIPE 'R: copy using cat-file' '\n \t)\n '\n \n-test_expect_success PIPE 'R: print blob mid-commit' '\n+test_expect_success PIPE 'print blob mid-commit' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -281,7 +281,7 @@ test_expect_success PIPE 'R: print blob mid-commit' '\n \t)\n '\n \n-test_expect_success PIPE 'R: print staged blob within commit' '\n+test_expect_success PIPE 'print staged blob within commit' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -322,7 +322,7 @@ test_expect_success PIPE 'R: print staged blob within commit' '\n \t)\n '\n \n-test_expect_success 'R: quiet option results in no stats being output' '\n+test_expect_success 'quiet option results in no stats being output' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -341,7 +341,7 @@ test_expect_success 'R: quiet option results in no stats being output' '\n \t)\n '\n \n-test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n+test_expect_success 'feature done means terminating \"done\" is mandatory' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -352,7 +352,7 @@ test_expect_success 'R: feature done means terminating \"done\" is mandatory' '\n \t)\n '\n \n-test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n+test_expect_success 'terminating \"done\" with trailing gibberish is ok' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -370,7 +370,7 @@ test_expect_success 'R: terminating \"done\" with trailing gibberish is ok' '\n \t)\n '\n \n-test_expect_success 'R: terminating \"done\" within commit' '\n+test_expect_success 'terminating \"done\" within commit' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -433,7 +433,7 @@ import_reference_commit () {\n \tINPUT_END\n }\n \n-test_expect_success 'O: comments are all skipped' '\n+test_expect_success 'comments are all skipped' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -485,7 +485,7 @@ test_expect_success 'O: comments are all skipped' '\n \t)\n '\n \n-test_expect_success 'O: blank lines not necessary after data commands' '\n+test_expect_success 'blank lines not necessary after data commands' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -523,7 +523,7 @@ test_expect_success 'O: blank lines not necessary after data commands' '\n \t)\n '\n \n-test_expect_success 'O: blank lines not necessary after other commands' '\n+test_expect_success 'blank lines not necessary after other commands' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -577,7 +577,7 @@ test_expect_success 'O: blank lines not necessary after other commands' '\n \t)\n '\n \n-test_expect_success 'O: progress outputs as requested by input' '\n+test_expect_success 'progress outputs as requested by input' '\n \tsetup_import_repo &&\n \t(\n \t\tcd repo &&\n@@ -616,7 +616,7 @@ test_expect_success 'O: progress outputs as requested by input' '\n ##\n ## R: very large blobs\n ##\n-test_expect_success 'R: blob bigger than threshold' '\n+test_expect_success 'blob bigger than threshold' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -671,7 +671,7 @@ w_input () {\n \tW_INPUT_END\n }\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with no newlines' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -681,7 +681,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with no newlines'\n \t)\n '\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with one newline' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -691,7 +691,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with one newline'\n \t)\n '\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second newline' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with ugly second newline' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -707,7 +707,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with ugly second n\n \t)\n '\n \n-test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous third newline' '\n+test_expect_success !MINGW 'get-mark & empty orphan commit with erroneous third newline' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -718,7 +718,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous thi\n \t)\n '\n \n-test_expect_success ICONV 'X: handling encoding' '\n+test_expect_success ICONV 'handling encoding' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -740,7 +740,7 @@ test_expect_success ICONV 'X: handling encoding' '\n \t)\n '\n \n-test_expect_success 'X: replace ref that becomes useless is removed' '\n+test_expect_success 'replace ref that becomes useless is removed' '\n \ttest_when_finished \"rm -rf testrepo\" &&\n \tgit init -qb main testrepo &&\n \t(\n@@ -771,7 +771,7 @@ test_expect_success 'X: replace ref that becomes useless is removed' '\n \n for root in '\"\"' ''\n do\n-\ttest_expect_success \"T: ls root ($root) tree\" '\n+\ttest_expect_success \"ls root ($root) tree\" '\n \t\ttest_when_finished \"rm -rf repo\" &&\n \t\tgit init repo &&\n \t\t(\n@@ -790,7 +790,7 @@ do\n \t'\n done\n \n-test_expect_success 'I: export-pack-edges' '\n+test_expect_success 'export-pack-edges' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init -b main repo &&\n \t(\n@@ -819,7 +819,7 @@ test_expect_success 'I: export-pack-edges' '\n \t)\n '\n \n-test_expect_success 'I: export-pack-edges option forbidden by default' '\n+test_expect_success 'export-pack-edges option forbidden by default' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -830,7 +830,7 @@ test_expect_success 'I: export-pack-edges option forbidden by default' '\n \t)\n '\n \n-test_expect_success 'I: export-pack-edges via stdin' '\n+test_expect_success 'export-pack-edges via stdin' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init -b main repo &&\n \t(\n@@ -859,7 +859,7 @@ test_expect_success 'I: export-pack-edges via stdin' '\n \t)\n '\n \n-test_expect_success 'R: --git-completion-helper does not read from stdin' '\n+test_expect_success '--git-completion-helper does not read from stdin' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -873,7 +873,7 @@ test_expect_success 'R: --git-completion-helper does not read from stdin' '\n \t)\n '\n \n-test_expect_success 'R: --git-completion-helper-all does not read from stdin' '\n+test_expect_success '--git-completion-helper-all does not read from stdin' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\ndiff --git a/t/t9309-fast-import-checkpoint.sh b/t/t9309-fast-import-checkpoint.sh\nindex 64674dcf83..5c1e80c240 100755\n--- a/t/t9309-fast-import-checkpoint.sh\n+++ b/t/t9309-fast-import-checkpoint.sh\n@@ -91,7 +91,7 @@ setup_checkpoint_repo () {\n \tINPUT_END\n }\n \n-test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '\n+test_expect_success PIPE 'checkpoint helper does not get stuck with extra output' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-INPUT_END &&\n \tprogress foo\n@@ -103,7 +103,7 @@ test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra out\n \tbackground_import_still_running\n '\n \n-test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n+test_expect_success PIPE 'checkpoint updates refs after reset' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-\\INPUT_END &&\n \treset refs/heads/V\n@@ -116,7 +116,7 @@ test_expect_success PIPE 'V: checkpoint updates refs after reset' '\n \tbackground_import_still_running\n '\n \n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n+test_expect_success PIPE 'checkpoint updates refs and marks after commit' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-INPUT_END &&\n \tcommit refs/heads/V\n@@ -140,7 +140,7 @@ test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '\n \n # Re-create the exact same commit, but on a different branch: no new object is\n # created in the database, but the refs and marks still need to be updated.\n-test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '\n+test_expect_success PIPE 'checkpoint updates refs and marks after commit (no new objects)' '\n \tsetup_checkpoint_repo &&\n \tgit -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&\n \tcommit refs/heads/V\n@@ -170,7 +170,7 @@ test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no\n \tbackground_import_still_running\n '\n \n-test_expect_success PIPE 'V: checkpoint updates tags after tag' '\n+test_expect_success PIPE 'checkpoint updates tags after tag' '\n \tsetup_checkpoint_repo &&\n \tcat >repo/input <<-INPUT_END &&\n \ttag Vtag\ndiff --git a/t/t9310-fast-import-submodule.sh b/t/t9310-fast-import-submodule.sh\nindex 74c20d39c5..23bbf2db85 100755\n--- a/t/t9310-fast-import-submodule.sh\n+++ b/t/t9310-fast-import-submodule.sh\n@@ -72,7 +72,7 @@ setup_gitlinks_repo () {\n \t)\n }\n \n-test_expect_success 'P: superproject & submodule mix' '\n+test_expect_success 'superproject & submodule mix' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -91,7 +91,7 @@ test_expect_success 'P: superproject & submodule mix' '\n \t)\n '\n \n-test_expect_success 'P: verbatim SHA gitlinks' '\n+test_expect_success 'verbatim SHA gitlinks' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -134,7 +134,7 @@ test_expect_success 'P: verbatim SHA gitlinks' '\n \t)\n '\n \n-test_expect_success 'P: fail on inline gitlink' '\n+test_expect_success 'fail on inline gitlink' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -161,7 +161,7 @@ test_expect_success 'P: fail on inline gitlink' '\n \t)\n '\n \n-test_expect_success 'P: fail on blob mark in gitlink' '\n+test_expect_success 'fail on blob mark in gitlink' '\n \tsetup_gitlinks_repo &&\n \t(\n \t\tcd repo &&\n@@ -277,7 +277,7 @@ cat >Y-marks <<\\Y_INPUT_END\n :4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7\n Y_INPUT_END\n \n-test_expect_success 'Y: rewrite submodules' '\n+test_expect_success 'rewrite submodules' '\n \ttest_when_finished \"rm -rf main1\" &&\n \ttest_oid_cache <<-EOF &&\n \tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\n@@ -295,7 +295,7 @@ test_expect_success 'Y: rewrite submodules' '\n \t)\n '\n \n-test_expect_success 'Y: reference pending tag or commit' '\n+test_expect_success 'reference pending tag or commit' '\n \ttest_oid_cache <<-EOF &&\n \tpending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04\n \tpending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d\n@@ -339,7 +339,7 @@ test_expect_success 'Y: reference pending tag or commit' '\n \t)\n '\n \n-test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n+test_expect_success 'rewrite-submodules-to feature forbidden by default' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -350,7 +350,7 @@ test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' '\n \t)\n '\n \n-test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n+test_expect_success 'rewrite-submodules-from feature forbidden by default' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -361,7 +361,7 @@ test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' '\n \t)\n '\n \n-test_expect_success 'Y: rewrite submodules via stdin' '\n+test_expect_success 'rewrite submodules via stdin' '\n \ttest_when_finished \"rm -rf main1\" &&\n \ttest_oid_cache <<-EOF &&\n \tYmain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504\ndiff --git a/t/t9311-fast-import-refs.sh b/t/t9311-fast-import-refs.sh\nindex 2bb8ac1d46..3283fe77c0 100755\n--- a/t/t9311-fast-import-refs.sh\n+++ b/t/t9311-fast-import-refs.sh\n@@ -13,7 +13,7 @@ setup_two_commit_repo () {\n \ttest_commit -C repo two\n }\n \n-test_expect_success 'F: non-fast-forward update skips' '\n+test_expect_success 'non-fast-forward update skips' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -55,7 +55,7 @@ test_expect_success 'F: non-fast-forward update skips' '\n \t)\n '\n \n-test_expect_success 'G: non-fast-forward update forced' '\n+test_expect_success 'non-fast-forward update forced' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -83,7 +83,7 @@ test_expect_success 'G: non-fast-forward update forced' '\n \t)\n '\n \n-test_expect_success 'J: reset existing branch creates empty commit' '\n+test_expect_success 'reset existing branch creates empty commit' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -112,7 +112,7 @@ test_expect_success 'J: reset existing branch creates empty commit' '\n \t)\n '\n \n-test_expect_success 'J: tag must fail on empty branch' '\n+test_expect_success 'tag must fail on empty branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -130,7 +130,7 @@ test_expect_success 'J: tag must fail on empty branch' '\n \t)\n '\n \n-test_expect_success 'K: reinit branch with from' '\n+test_expect_success 'reinit branch with from' '\n \tsetup_two_commit_repo &&\n \t(\n \t\tcd repo &&\n@@ -159,7 +159,7 @@ test_expect_success 'K: reinit branch with from' '\n \t)\n '\n \n-test_expect_success 'T: delete branch' '\n+test_expect_success 'delete branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n@@ -175,7 +175,7 @@ test_expect_success 'T: delete branch' '\n \t)\n '\n \n-test_expect_success 'T: empty reset doesnt delete branch' '\n+test_expect_success 'empty reset doesnt delete branch' '\n \ttest_when_finished \"rm -rf repo\" &&\n \tgit init repo &&\n \t(\n\n-- \n2.56.GIT\n\n\n"}]}