[PATCH 03/20] t9300: make the series T tests self-contained
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Nov 10, 2026, 11:49 UTC
- Message-ID
- <20261110-kn-fast-import-tests-1-v1-3-dbd9ee502aae@gmail.com>
- In-Reply-To
- <20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@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 <karthik.188@gmail.com> --- 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 1b34f6491c..76cc9504eb 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -3525,38 +3525,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