Thread View: linux.kernel.git
2 messages
2 total messages
Started by Karthik Nayak
Thu, 12 Nov 2026 17:34
[PATCH v2 03/20] t9300: make the series T tests self-contained
Author: Karthik Nayak
Date: Thu, 12 Nov 2026 17:34
Date: Thu, 12 Nov 2026 17:34
102 lines
14394 bytes
14394 bytes
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 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
Re: [PATCH v2 03/20] t9300: make the series T tests self-contained
Author: Kaartic Sivaraam
Date: Thu, 19 Nov 2026 12:45
Date: Thu, 19 Nov 2026 12:45
77 lines
12800 bytes
12800 bytes
On 11/12/26 23:04, Karthik Nayak wrote:
> @@ -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
>
We lose the --import-marks dependency from series S as the commit
message indicated.
> [ ... snip ... ]
>
> 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
> + )
> '
>
> ###
>
The rest is just wrapping of test body within a subshell to make them
get their own repository.
Looks good to me.
--
Sivaraam
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads