From: Karthik Nayak Date: Thu, 12 Nov 2026 17:34:03 GMT Subject: [PATCH v2 03/20] t9300: make the series T tests self-contained Message-ID: <20261112-kn-fast-import-tests-1-v2-3-b8c3a0ab27e8@gmail.com> In-Reply-To: <20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com> Similar to the previous commit, modify the tests in 'series T' to make them independent of state from preceding tests. The 'ls root' tests list the root tree of the 'S' branch, using the marks left behind by series S. The expected output is derived from the commit itself, so any commit will do. Run them against a commit created in a new repository instead. Run the branch tests in a new repository too. Signed-off-by: Karthik Nayak --- t/t9300-fast-import.sh | 62 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index e2cf0b7a22..a0e322b866 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -3602,38 +3602,58 @@ test_path_eol_quoted_fail 'ls (without dataref in commit)' 'ls ' path ### ### series T (ls) ### -# Setup is carried over from series S. for root in '""' '' do test_expect_success "T: ls root ($root) tree" ' - sed -e "s/Z\$//" >expect <<-EOF && - 040000 tree $(git rev-parse S^{tree}) Z - EOF - sha1=$(git rev-parse --verify S) && - git fast-import --import-marks=marks <<-EOF >actual && - ls $sha1 $root - EOF - test_cmp expect actual + test_when_finished "rm -rf repo" && + git init repo && + ( + cd repo && + test_commit one && + + sed -e "s/Z\$//" >expect <<-EOF && + 040000 tree $(git rev-parse HEAD^{tree}) Z + EOF + sha1=$(git rev-parse --verify HEAD) && + git fast-import <<-EOF >actual && + ls $sha1 $root + EOF + test_cmp expect actual + ) ' done test_expect_success 'T: delete branch' ' - git branch to-delete && - git fast-import <<-EOF && - reset refs/heads/to-delete - from $ZERO_OID - EOF - test_must_fail git rev-parse --verify refs/heads/to-delete + test_when_finished "rm -rf repo" && + git init repo && + ( + cd repo && + test_commit one && + + git branch to-delete && + git fast-import <<-EOF && + reset refs/heads/to-delete + from $ZERO_OID + EOF + test_must_fail git rev-parse --verify refs/heads/to-delete + ) ' test_expect_success 'T: empty reset doesnt delete branch' ' - git branch not-to-delete && - git fast-import <<-EOF && - reset refs/heads/not-to-delete - EOF - git show-ref && - git rev-parse --verify refs/heads/not-to-delete + test_when_finished "rm -rf repo" && + git init repo && + ( + cd repo && + test_commit one && + + git branch not-to-delete && + git fast-import <<-EOF && + reset refs/heads/not-to-delete + EOF + git show-ref && + git rev-parse --verify refs/heads/not-to-delete + ) ' ### -- 2.56.GIT