Skip to content

Commit bb431c3

Browse files
phillipwoodgitster
authored andcommitted
t3420: remove progress lines before comparing output
Some of the tests check the output of rebase is what we expect. These were added after a regression that added unwanted stash output when using --autostash. They are useful as they prevent unintended changes to the output of the various rebase commands. However they also include all the progress output which is less useful as it only tests what would be written to a dumb terminal which is not the normal use case. The recent changes to fix clearing the line when printing progress necessarily meant making an ugly change to these tests. Address this my removing the progress output before comparing it to the expected output. We do this by removing everything before the final "\r" on each line as we don't care about the progress indicator, but we do care about what is printed immediately after it. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b12e31 commit bb431c3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

t/t3420-rebase-autostash.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ test_expect_success setup '
3030
echo conflicting-change >file2 &&
3131
git add . &&
3232
test_tick &&
33-
git commit -m "related commit"
33+
git commit -m "related commit" &&
34+
remove_progress_re="$(printf "s/.*\\r//")"
3435
'
3536

3637
create_expected_success_am () {
@@ -48,8 +49,8 @@ create_expected_success_interactive () {
4849
q_to_cr >expected <<-EOF
4950
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
5051
HEAD is now at $(git rev-parse --short feature-branch) third commit
51-
Rebasing (1/2)QRebasing (2/2)QApplied autostash.
52-
Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
52+
Applied autostash.
53+
Successfully rebased and updated refs/heads/rebased-feature-branch.
5354
EOF
5455
}
5556

@@ -67,13 +68,13 @@ create_expected_failure_am () {
6768
}
6869

6970
create_expected_failure_interactive () {
70-
q_to_cr >expected <<-EOF
71+
cat >expected <<-EOF
7172
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
7273
HEAD is now at $(git rev-parse --short feature-branch) third commit
73-
Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
74+
Applying autostash resulted in conflicts.
7475
Your changes are safe in the stash.
7576
You can run "git stash pop" or "git stash drop" at any time.
76-
Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
77+
Successfully rebased and updated refs/heads/rebased-feature-branch.
7778
EOF
7879
}
7980

@@ -109,7 +110,8 @@ testrebase () {
109110
suffix=interactive
110111
fi &&
111112
create_expected_success_$suffix &&
112-
test_i18ncmp expected actual
113+
sed "$remove_progress_re" <actual >actual2 &&
114+
test_i18ncmp expected actual2
113115
'
114116

115117
test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
@@ -209,7 +211,8 @@ testrebase () {
209211
suffix=interactive
210212
fi &&
211213
create_expected_failure_$suffix &&
212-
test_i18ncmp expected actual
214+
sed "$remove_progress_re" <actual >actual2 &&
215+
test_i18ncmp expected actual2
213216
'
214217
}
215218

0 commit comments

Comments
 (0)