From: Karthik Nayak Date: Thu, 12 Nov 2026 17:34:00 GMT Subject: [PATCH v2 00/20] t9300: group and move tests to other files Message-ID: <20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com> In-Reply-To: <20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com> While reading the git-fast-import(1) code, I stumbled upon t9300. The test file is around 4000 LoC and each test has some dependency on the state setup by previous tests. This long series unwinds some of these tests and moves them into new/existing tests based on what they exercise. This leaves t9300 in a better state. I think we can do more here, but I decided to stop before this series got even longer. Based on the reception of this series, I will follow up with more cleanups. Also, we could squash some of the commits together. But I found them easier to read through this way. --- Changes in v2: - Rebased on top master: 1891de46f7 (Sync with Git 2.56.1, 2026-11-09) - Merged in and resolved conflicts from the topics in next: - cc/early-scan-options - tj/drop-no-parseopt - Did some small cleanups - Link to v1: https://patch.msgid.link/20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com --- Karthik Nayak (20): t9300: move 'fastimport.unpackLimit' to the required test t9300: make the series B tests self-contained t9300: make the series T tests self-contained t9300: make the series S tests self-contained t9300: make the series V tests self-contained t9300: make the series Q tests self-contained t9300: make the series P tests self-contained t9300: make the series O tests self-contained t9300: make the big blob tests self-contained t9300: make the ref update tests self-contained t9300: make the date format tests self-contained t9300: make the pack edges test self-contained t9300: make the marks tests self-contained t9300: make the series Y tests self-contained t9300: make the cat-blob tests self-contained t9300: make the feature and option tests self-contained t9300: make the stream tests self-contained t9300: make the get-mark and encoding tests self-contained t9300: move self-contained tests into dedicated files t93xx: drop the series letter from the moved test names t/meson.build | 5 + t/t9300-fast-import.sh | 2884 +------------------------------------ t/t9301-fast-import-notes.sh | 400 +++++ t/t9304-fast-import-marks.sh | 393 +++++ t/t9307-fast-import-validation.sh | 1262 ++++++++++++++++ t/t9308-fast-import-stream.sh | 890 ++++++++++++ t/t9309-fast-import-checkpoint.sh | 188 +++ t/t9310-fast-import-submodule.sh | 385 +++++ t/t9311-fast-import-refs.sh | 194 +++ 9 files changed, 3718 insertions(+), 2883 deletions(-) Range-diff versus v1: 1: 45b5b440f4 = 1: e3f2bfcc69 t9300: move 'fastimport.unpackLimit' to the required test 2: 130034d57d = 2: 649260b54d t9300: make the series B tests self-contained 3: 9fe75bdaf2 = 3: 7b134f184d t9300: make the series T tests self-contained 4: a9c1bd2483 ! 4: b401701e1e t9300: make the series S tests self-contained @@ Commit message Signed-off-by: Karthik Nayak ## t/t9300-fast-import.sh ## -@@ t/t9300-fast-import.sh: test_expect_success 'R: blob appears only once' ' +@@ t/t9300-fast-import.sh: test_expect_success 'R: --git-completion-helper-all does not read from stdin' ' # # invalid dataref .. # 5: a8b7bf3aa4 = 5: 18ffcfcfd9 t9300: make the series V tests self-contained 6: 73f94d5790 ! 6: b81ec42557 t9300: make the series Q tests self-contained @@ Commit message commit notes', and use shell variables set by the preceding tests. Replace 'Q: commit notes' with a 'setup_notes_repo()' function, which creates a new repository, runs the import and sets those variables, so - each test can invoke it. Run the import with 'fastimport.unpackLimit' - set to 0, so that a pack is written for 'Q: verify pack' to check. + each test can invoke it. - Also stop using the 'verify_packs()' function, to make it easier to move - these tests to another file. + Drop 'Q: verify pack', as other tests already verify the packs written + by fast-import. Signed-off-by: Karthik Nayak @@ t/t9300-fast-import.sh: test_expect_success 'Q: commit notes' ' - git fast-import before && + echo garbage | git fast-import --git-completion-helper >out && 10: 178e01d022 ! 10: 6104474191 t9300: make the ref update tests self-contained @@ Commit message series 'F', 'G', 'J' and 'K' to make them independent of state from previous tests. Add a 'setup_two_commit_repo()' function which creates a repository with two commits on 'main', so each test can invoke it. - The tests used to build on the 'branch' branch of earlier tests. Fold the tests which only check the result of an import into the tests performing it, as they can't run on their own. As @@ t/t9300-fast-import.sh: test_expect_success 'F: verify other commit' ' ' ### -@@ t/t9300-fast-import.sh: test_expect_success 'I: verify edge list' ' +@@ t/t9300-fast-import.sh: test_expect_success 'I: export-pack-edges via stdin' ' ### test_expect_success 'J: reset existing branch creates empty commit' ' 11: d94431d13c = 11: 6c1b12057c t9300: make the date format tests self-contained 12: 44d3602cbc ! 12: 5d1e8cada1 t9300: make the pack edges test self-contained @@ Commit message Similar to the previous commits, modify the pack-edges tests to make them independent of state from previous tests. - Fold 'I: verify edge list' into the test creating the edge list, as it - can't run on its own. Pack edges are only recorded for packs which are - kept, so set 'fastimport.unpackLimit' to 0 for the import. + Pack edges are only recorded for packs which are kept, so set + 'fastimport.unpackLimit' to 0 for the import. Create the repository with 'git init -b main', as the import builds on 'main' and t9302, where this test ends up, doesn't set @@ t/t9300-fast-import.sh @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' ' ### + test_expect_success 'I: export-pack-edges option forbidden by default' ' +- echo "option git export-pack-edges=edges.list" >input && +- test_must_fail git fast-import err && +- test_grep "option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features" err ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ echo "option git export-pack-edges=edges.list" >input && ++ test_must_fail git fast-import err && ++ test_grep "option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features" err ++ ) + ' + test_expect_success 'I: export-pack-edges' ' +- test_when_finished "rm edges.list" && - cat >input <<-INPUT_END && - commit refs/heads/export-boundary - committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' ' + COMMIT - INPUT_END -- git fast-import --export-pack-edges=edges.list expect <<-EOF && - .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary) - EOF - sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && - test_cmp expect actual ++ from refs/heads/main ++ + INPUT_END + git -c fastimport.unpackLimit=0 fast-import \ + --export-pack-edges=edges.list input <<-INPUT_END && +- option git export-pack-edges=edges.list +- commit refs/heads/export-boundary-2 +- committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +- data <input <<-INPUT_END && ++ option git export-pack-edges=edges.list ++ commit refs/heads/export-boundary ++ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE ++ data <expect <<-EOF && +- .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary-2) +- EOF +- sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && +- test_cmp expect actual ++ from refs/heads/main ++ ++ INPUT_END ++ ++ git -c fastimport.unpackLimit=0 fast-import \ ++ --allow-unsafe-features expect <<-EOF && ++ .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary) ++ EOF ++ sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && ++ test_cmp expect actual ++ ) + ' + ### 13: 54f456a8b3 ! 13: 80552f9997 t9300: make the marks tests self-contained @@ t/t9300-fast-import.sh: test_expect_success 'R: export-marks feature forbidden b + ) ' + test_expect_success 'R: --allow-unsafe-features found after a value' ' +@@ t/t9300-fast-import.sh: test_expect_success 'R: --allow-unsafe-features after a non-option' ' + ' + test_expect_success 'R: catch typo in marks file name' ' - test_must_fail git fast-import --import-marks=nonexistent.marks 14: 7d3e0b60f1 t9300: make the series Y tests self-contained 15: dd62943ca0 ! 15: 935ae34fbf t9300: make the cat-blob tests self-contained @@ Metadata ## Commit message ## t9300: make the cat-blob tests self-contained - The 'R: print' tests and 'R: copy using cat-file' write blobs into the - repository of the trash directory, which all other tests share. 'R: - print two blobs to stdout' and 'R: copy using cat-file' also read the - 'big' file written by the preceding 'setup: big file' test, so they - can't run on their own. - - Run each of these tests in a new repository. Convert the setup test to a - 'setup_big_file()' function, which writes the file in the repository of - the calling test, and invoke it from both tests. + Similar to the previous commits, modify the cat-blog tests to make + them independent of state from previous tests. Signed-off-by: Karthik Nayak 16: 25609c8979 ! 16: 405057430f t9300: make the feature and option tests self-contained @@ t/t9300-fast-import.sh: test_expect_success 'Q: deny note on empty branch' ' ' test_expect_success 'R: export-marks feature results in a marks file being created' ' +@@ t/t9300-fast-import.sh: test_expect_success 'R: export-marks options can be overridden by commandline op + ' + + test_expect_success 'R: --allow-unsafe-features found after a value' ' +- echo "feature import-marks-if-exists=nonexistent.marks" >input && +- git fast-import --allow-unsafe-features input && ++ git fast-import --allow-unsafe-features input && +- GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ +- git fast-import --allow-unsafe input && ++ GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ ++ git fast-import --allow-unsafe input && +- test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \ +- git fast-import --allow-unsafe err && +- test_grep "forbidden in input without --allow-unsafe-features" err ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ echo "feature import-marks-if-exists=nonexistent.marks" >input && ++ test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \ ++ git fast-import --allow-unsafe err && ++ test_grep "forbidden in input without --allow-unsafe-features" err ++ ) + ' + + test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' ' +- echo "feature import-marks-if-exists=nonexistent.marks" >input && +- test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ +- git fast-import --quiet --export-pack \ +- --allow-unsafe-features err && +- test_grep "forbidden in input without --allow-unsafe-features" err ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ echo "feature import-marks-if-exists=nonexistent.marks" >input && ++ test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ ++ git fast-import --quiet --export-pack \ ++ --allow-unsafe-features err && ++ test_grep "forbidden in input without --allow-unsafe-features" err ++ ) + ' + + test_expect_success 'R: --allow-unsafe-features after a non-option' ' +- echo "feature import-marks-if-exists=nonexistent.marks" >input && +- test_must_fail git fast-import --depth 5 extra \ +- --allow-unsafe-features err && +- test_grep "forbidden in input without --allow-unsafe-features" err ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ echo "feature import-marks-if-exists=nonexistent.marks" >input && ++ test_must_fail git fast-import --depth 5 extra \ ++ --allow-unsafe-features err && ++ test_grep "forbidden in input without --allow-unsafe-features" err ++ ) + ' + + test_expect_success 'R: catch typo in marks file name' ' @@ t/t9300-fast-import.sh: test_expect_success 'R: feature no-relative-marks should be honoured' ' 17: 7573e1381d ! 17: bafacc9dd4 t9300: make the stream tests self-contained @@ t/t9300-fast-import.sh: test_expect_success PIPE 'R: print staged blob within co ' test_expect_success 'R: die on unknown option' ' +@@ t/t9300-fast-import.sh: test_expect_success 'R: blob bigger than threshold' ' + ' + + test_expect_success 'R: --git-completion-helper does not read from stdin' ' +- find .git/objects/pack -name "tmp_pack_*" >before && +- echo garbage | git fast-import --git-completion-helper >out && +- test_grep -e "--date-format=" out && +- find .git/objects/pack -name "tmp_pack_*" >after && +- test_cmp before after ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ find .git/objects/pack -name "tmp_pack_*" >before && ++ echo garbage | git fast-import --git-completion-helper >out && ++ test_grep -e "--date-format=" out && ++ find .git/objects/pack -name "tmp_pack_*" >after && ++ test_cmp before after ++ ) + ' + + test_expect_success 'R: --git-completion-helper-all does not read from stdin' ' +- find .git/objects/pack -name "tmp_pack_*" >before && +- echo garbage | git fast-import --git-completion-helper-all >all && +- test_grep -e "--allow-unsafe-features" all && +- find .git/objects/pack -name "tmp_pack_*" >after && +- test_cmp before after ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ find .git/objects/pack -name "tmp_pack_*" >before && ++ echo garbage | git fast-import --git-completion-helper-all >all && ++ test_grep -e "--allow-unsafe-features" all && ++ find .git/objects/pack -name "tmp_pack_*" >after && ++ test_cmp before after ++ ) + ' + + ### 18: fb94ca9bc4 = 18: 100ad72f13 t9300: make the get-mark and encoding tests self-contained 19: 29df1daba9 ! 19: f3c7d85bd9 t9300: move self-contained tests into dedicated files @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' ' -### series I -### - +-test_expect_success 'I: export-pack-edges option forbidden by default' ' +- test_when_finished "rm -rf repo" && +- git init repo && +- ( +- cd repo && +- echo "option git export-pack-edges=edges.list" >input && +- test_must_fail git fast-import err && +- test_grep "option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features" err +- ) +-' +- -test_expect_success 'I: export-pack-edges' ' - test_when_finished "rm -rf repo" && - git init -b main repo && @@ t/t9300-fast-import.sh: test_expect_success 'H: verify file' ' - ) -' - +-test_expect_success 'I: export-pack-edges via stdin' ' +- test_when_finished "rm -rf repo" && +- git init -b main repo && +- ( +- cd repo && +- test_commit one && +- +- cat >input <<-INPUT_END && +- option git export-pack-edges=edges.list +- commit refs/heads/export-boundary +- committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +- data <expect <<-EOF && +- .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary) +- EOF +- sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && +- test_cmp expect actual +- ) +-' +- -### -### series J -### @@ t/t9300-fast-import.sh: do -### -### series O -### -- + -setup_import_repo () { - test_when_finished "rm -rf repo" && - git init repo && @@ t/t9300-fast-import.sh: do - - INPUT_END - -- git -C repo -c fastimport.unpackLimit=0 fast-import input && +- git fast-import --allow-unsafe-features input && +- GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ +- git fast-import --allow-unsafe input && +- test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \ +- git fast-import --allow-unsafe err && +- test_grep "forbidden in input without --allow-unsafe-features" err +- ) +-' +- +-test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' ' +- test_when_finished "rm -rf repo" && +- git init repo && +- ( +- cd repo && +- +- echo "feature import-marks-if-exists=nonexistent.marks" >input && +- test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ +- git fast-import --quiet --export-pack \ +- --allow-unsafe-features err && +- test_grep "forbidden in input without --allow-unsafe-features" err +- ) +-' +- +-test_expect_success 'R: --allow-unsafe-features after a non-option' ' +- test_when_finished "rm -rf repo" && +- git init repo && +- ( +- cd repo && +- +- echo "feature import-marks-if-exists=nonexistent.marks" >input && +- test_must_fail git fast-import --depth 5 extra \ +- --allow-unsafe-features err && +- test_grep "forbidden in input without --allow-unsafe-features" err +- ) +-' +- -test_expect_success 'R: catch typo in marks file name' ' - test_when_finished "rm -rf repo" && - git init repo && @@ t/t9300-fast-import.sh: do - ) -' - +-test_expect_success 'R: --git-completion-helper does not read from stdin' ' +- test_when_finished "rm -rf repo" && +- git init repo && +- ( +- cd repo && +- +- find .git/objects/pack -name "tmp_pack_*" >before && +- echo garbage | git fast-import --git-completion-helper >out && +- test_grep -e "--date-format=" out && +- find .git/objects/pack -name "tmp_pack_*" >after && +- test_cmp before after +- ) +-' +- +-test_expect_success 'R: --git-completion-helper-all does not read from stdin' ' +- test_when_finished "rm -rf repo" && +- git init repo && +- ( +- cd repo && +- +- find .git/objects/pack -name "tmp_pack_*" >before && +- echo garbage | git fast-import --git-completion-helper-all >all && +- test_grep -e "--allow-unsafe-features" all && +- find .git/objects/pack -name "tmp_pack_*" >after && +- test_cmp before after +- ) +-' +- -### -### series S (mark and path parsing) -### @@ t/t9300-fast-import.sh: do - git rev-parse --verify refs/heads/not-to-delete - ) -' -- + ### ### series U (filedelete) - ### @@ t/t9300-fast-import.sh: do ' done @@ t/t9300-fast-import.sh: do -:4 ff729f5e62f72c0c3978207d9a80e5f3a65f14d7 -Y_INPUT_END - +-test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' ' +- test_when_finished "rm -rf repo" && +- git init repo && +- ( +- cd repo && +- echo "feature rewrite-submodules-to=sub:sub2-marks" >input && +- test_must_fail git fast-import err && +- test_grep "feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features" err +- ) +-' +- +-test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' ' +- test_when_finished "rm -rf repo" && +- git init repo && +- ( +- cd repo && +- echo "feature rewrite-submodules-from=sub:../Y-marks" >input && +- test_must_fail git fast-import err && +- test_grep "feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features" err +- ) +-' +- -test_expect_success 'Y: rewrite submodules' ' - test_when_finished "rm -rf main1" && - test_oid_cache <<-EOF && - Ymain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504 - Ymain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3 - EOF +- - git init main1 && - ( - cd main1 && @@ t/t9300-fast-import.sh: do - EOF - ) -' +- +-test_expect_success 'Y: rewrite submodules via stdin' ' +- test_when_finished "rm -rf main1" && +- test_oid_cache <<-EOF && +- Ymain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504 +- Ymain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3 +- EOF +- +- git init main1 && +- ( +- cd main1 && +- git init sub2 && +- git -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input && +- { +- echo "feature rewrite-submodules-to=sub:sub2-marks" && +- echo "feature rewrite-submodules-from=sub:../Y-marks" && +- cat ../Y-main-input +- } | git fast-import --allow-unsafe-features && +- test "$(git rev-parse main)" = "$(test_oid Ymain)" +- ) +-' - test_done @@ t/t9301-fast-import-notes.sh: test_expect_success "add notes to $num_commits com + + INPUT_END + -+ git -C repo -c fastimport.unpackLimit=0 fast-import input && ++ git fast-import --allow-unsafe-features input && ++ GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ ++ git fast-import --allow-unsafe input && ++ test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true \ ++ git fast-import --allow-unsafe err && ++ test_grep "forbidden in input without --allow-unsafe-features" err ++ ) ++' ++ ++test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' ' ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ echo "feature import-marks-if-exists=nonexistent.marks" >input && ++ test_must_fail env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \ ++ git fast-import --quiet --export-pack \ ++ --allow-unsafe-features err && ++ test_grep "forbidden in input without --allow-unsafe-features" err ++ ) ++' ++ ++test_expect_success 'R: --allow-unsafe-features after a non-option' ' ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ echo "feature import-marks-if-exists=nonexistent.marks" >input && ++ test_must_fail git fast-import --depth 5 extra \ ++ --allow-unsafe-features err && ++ test_grep "forbidden in input without --allow-unsafe-features" err ++ ) ++' ++ +test_done ## t/t9308-fast-import-stream.sh (new) ## @@ t/t9308-fast-import-stream.sh (new) + ) +' + ++test_expect_success 'I: export-pack-edges option forbidden by default' ' ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ echo "option git export-pack-edges=edges.list" >input && ++ test_must_fail git fast-import err && ++ test_grep "option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features" err ++ ) ++' ++ ++test_expect_success 'I: export-pack-edges via stdin' ' ++ test_when_finished "rm -rf repo" && ++ git init -b main repo && ++ ( ++ cd repo && ++ test_commit one && ++ ++ cat >input <<-INPUT_END && ++ option git export-pack-edges=edges.list ++ commit refs/heads/export-boundary ++ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE ++ data <expect <<-EOF && ++ .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary) ++ EOF ++ sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && ++ test_cmp expect actual ++ ) ++' ++ ++test_expect_success 'R: --git-completion-helper does not read from stdin' ' ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ find .git/objects/pack -name "tmp_pack_*" >before && ++ echo garbage | git fast-import --git-completion-helper >out && ++ test_grep -e "--date-format=" out && ++ find .git/objects/pack -name "tmp_pack_*" >after && ++ test_cmp before after ++ ) ++' ++ ++test_expect_success 'R: --git-completion-helper-all does not read from stdin' ' ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ ++ find .git/objects/pack -name "tmp_pack_*" >before && ++ echo garbage | git fast-import --git-completion-helper-all >all && ++ test_grep -e "--allow-unsafe-features" all && ++ find .git/objects/pack -name "tmp_pack_*" >after && ++ test_cmp before after ++ ) ++' ++ +test_done ## t/t9309-fast-import-checkpoint.sh (new) ## @@ t/t9310-fast-import-submodule.sh (new) + Ymain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504 + Ymain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3 + EOF ++ + git init main1 && + ( + cd main1 && @@ t/t9310-fast-import-submodule.sh (new) + ) +' + ++test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' ' ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ echo "feature rewrite-submodules-to=sub:sub2-marks" >input && ++ test_must_fail git fast-import err && ++ test_grep "feature ${SQ}rewrite-submodules-to${SQ} forbidden in input without --allow-unsafe-features" err ++ ) ++' ++ ++test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' ' ++ test_when_finished "rm -rf repo" && ++ git init repo && ++ ( ++ cd repo && ++ echo "feature rewrite-submodules-from=sub:../Y-marks" >input && ++ test_must_fail git fast-import err && ++ test_grep "feature ${SQ}rewrite-submodules-from${SQ} forbidden in input without --allow-unsafe-features" err ++ ) ++' ++ ++test_expect_success 'Y: rewrite submodules via stdin' ' ++ test_when_finished "rm -rf main1" && ++ test_oid_cache <<-EOF && ++ Ymain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504 ++ Ymain sha256:c0a1010da1df187b2e287654793df01b464bd6f8e3f17fc1481a7dadf84caee3 ++ EOF ++ ++ git init main1 && ++ ( ++ cd main1 && ++ git init sub2 && ++ git -C sub2 fast-import --export-marks=../sub2-marks <../Y-sub-input && ++ { ++ echo "feature rewrite-submodules-to=sub:sub2-marks" && ++ echo "feature rewrite-submodules-from=sub:../Y-marks" && ++ cat ../Y-main-input ++ } | git fast-import --allow-unsafe-features && ++ test "$(git rev-parse main)" = "$(test_oid Ymain)" ++ ) ++' ++ +test_done ## t/t9311-fast-import-refs.sh (new) ## 20: 80524815fd ! 20: 26f81a22b7 t93xx: drop the series letter from the moved test names @@ t/t9301-fast-import-notes.sh: echo \"\$@\"" && commit3=$(git -C repo rev-parse notes-test) } --test_expect_success 'Q: verify pack' ' -+test_expect_success 'verify pack' ' - setup_notes_repo && - ( - cd repo && -@@ t/t9301-fast-import-notes.sh: test_expect_success 'Q: verify pack' ' - ) - ' - -test_expect_success 'Q: verify first commit' ' +test_expect_success 'verify first commit' ' setup_notes_repo && @@ t/t9307-fast-import-validation.sh: test_expect_success 'E: rfc2822 date, --date- test_when_finished "rm -rf repo" && git init repo && ( +@@ t/t9307-fast-import-validation.sh: test_expect_success 'E: rfc2822 date, --date-format=rfc2822' ' + ) + ' + +-test_expect_success 'R: --allow-unsafe-features found after a value' ' ++test_expect_success '--allow-unsafe-features found after a value' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: --allow-unsafe-features found after a value' ' + ) + ' + +-test_expect_success 'R: --allow-unsafe-features can be abbreviated' ' ++test_expect_success '--allow-unsafe-features can be abbreviated' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: --allow-unsafe-features can be abbreviated' ' + ) + ' + +-test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' ' ++test_expect_success 'disallowed abbreviation of --allow-unsafe-features' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: disallowed abbreviation of --allow-unsafe-features' ' + ) + ' + +-test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' ' ++test_expect_success '--allow-unsafe-features as the value of an abbreviation' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9307-fast-import-validation.sh: test_expect_success 'R: --allow-unsafe-features as the value of an abbreviation' + ) + ' + +-test_expect_success 'R: --allow-unsafe-features after a non-option' ' ++test_expect_success '--allow-unsafe-features after a non-option' ' + test_when_finished "rm -rf repo" && + git init repo && + ( ## t/t9308-fast-import-stream.sh ## @@ t/t9308-fast-import-stream.sh: test_expect_success 'truncated stream complains' ' @@ t/t9308-fast-import-stream.sh: do test_when_finished "rm -rf repo" && git init -b main repo && ( +@@ t/t9308-fast-import-stream.sh: test_expect_success 'I: export-pack-edges' ' + ) + ' + +-test_expect_success 'I: export-pack-edges option forbidden by default' ' ++test_expect_success 'export-pack-edges option forbidden by default' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9308-fast-import-stream.sh: test_expect_success 'I: export-pack-edges option forbidden by default' ' + ) + ' + +-test_expect_success 'I: export-pack-edges via stdin' ' ++test_expect_success 'export-pack-edges via stdin' ' + test_when_finished "rm -rf repo" && + git init -b main repo && + ( +@@ t/t9308-fast-import-stream.sh: test_expect_success 'I: export-pack-edges via stdin' ' + ) + ' + +-test_expect_success 'R: --git-completion-helper does not read from stdin' ' ++test_expect_success '--git-completion-helper does not read from stdin' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9308-fast-import-stream.sh: test_expect_success 'R: --git-completion-helper does not read from stdin' ' + ) + ' + +-test_expect_success 'R: --git-completion-helper-all does not read from stdin' ' ++test_expect_success '--git-completion-helper-all does not read from stdin' ' + test_when_finished "rm -rf repo" && + git init repo && + ( ## t/t9309-fast-import-checkpoint.sh ## @@ t/t9309-fast-import-checkpoint.sh: setup_checkpoint_repo () { @@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: rewrite submodules' ' test_oid_cache <<-EOF && pending_commit sha1:85b46dd918355ff17b4109ec738723d42f235a04 pending_commit sha256:17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d +@@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: reference pending tag or commit' ' + ) + ' + +-test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' ' ++test_expect_success 'rewrite-submodules-to feature forbidden by default' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: rewrite-submodules-to feature forbidden by default' ' + ) + ' + +-test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' ' ++test_expect_success 'rewrite-submodules-from feature forbidden by default' ' + test_when_finished "rm -rf repo" && + git init repo && + ( +@@ t/t9310-fast-import-submodule.sh: test_expect_success 'Y: rewrite-submodules-from feature forbidden by default' ' + ) + ' + +-test_expect_success 'Y: rewrite submodules via stdin' ' ++test_expect_success 'rewrite submodules via stdin' ' + test_when_finished "rm -rf main1" && + test_oid_cache <<-EOF && + Ymain sha1:9afed2f9161ddf416c0a1863b8b0725b00070504 ## t/t9311-fast-import-refs.sh ## @@ t/t9311-fast-import-refs.sh: setup_two_commit_repo () { --- base-commit: faeb455a72c105b44c92ebedae5e771bad5bc853 change-id: 20261102-kn-fast-import-tests-1-03de57101c3b Thanks - Karthik