Skip to content

Commit aac1c6e

Browse files
phillipwoodgitster
authored andcommitted
t3428: modernize test setup
Perform the setup in a dedicated test so the later tests can be run independently. Also avoid running git upstream of a pipe and take advantage of test_commit. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d1bd1d commit aac1c6e

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

t/t3428-rebase-signoff.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@ This test runs git rebase --signoff and make sure that it works.
88
TEST_PASSES_SANITIZE_LEAK=true
99
. ./test-lib.sh
1010

11-
# A simple file to commit
12-
cat >file <<EOF
13-
a
14-
EOF
11+
test_expect_success 'setup' '
12+
git commit --allow-empty -m "Initial empty commit" &&
13+
test_commit first file a &&
14+
15+
ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" &&
1516
16-
# Expected commit message for initial commit after rebase --signoff
17-
cat >expected-initial-signed <<EOF
18-
Initial empty commit
17+
# Expected commit message for initial commit after rebase --signoff
18+
cat >expected-initial-signed <<-EOF &&
19+
Initial empty commit
1920
20-
Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
21-
EOF
21+
Signed-off-by: $ident
22+
EOF
2223
23-
# Expected commit message after rebase --signoff
24-
cat >expected-signed <<EOF
25-
first
24+
# Expected commit message after rebase --signoff
25+
cat >expected-signed <<-EOF &&
26+
first
2627
27-
Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
28-
EOF
28+
Signed-off-by: $ident
29+
EOF
2930
30-
# Expected commit message after rebase without --signoff (or with --no-signoff)
31-
cat >expected-unsigned <<EOF
32-
first
33-
EOF
31+
# Expected commit message after rebase without --signoff (or with --no-signoff)
32+
cat >expected-unsigned <<-EOF &&
33+
first
34+
EOF
3435
36+
git config alias.rbs "rebase --signoff"
37+
'
3538

3639
# We configure an alias to do the rebase --signoff so that
3740
# on the next subtest we can show that --no-signoff overrides the alias
3841
test_expect_success 'rebase --signoff adds a sign-off line' '
39-
git commit --allow-empty -m "Initial empty commit" &&
40-
git add file && git commit -m first &&
41-
git config alias.rbs "rebase --signoff" &&
4242
git rbs HEAD^ &&
4343
git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
4444
test_cmp expected-signed actual

0 commit comments

Comments
 (0)