Skip to content

Commit f2f3fc9

Browse files
peffgitster
authored andcommitted
t3903: stop hard-coding commit sha1s
When testing the diff output of "git stash list", we look for the stash's subject of "WIP on master: $sha1", even though it's not relevant to the diff output. This makes the test brittle to refactoring, as any changes to earlier tests may impact the commit sha1. Since we don't care about the commit subject here, we can simply ask stash not to print it. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fdf96a2 commit f2f3fc9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

t/t3903-stash.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,8 @@ test_expect_success 'setup stash with index and worktree changes' '
695695
'
696696

697697
test_expect_success 'stash list implies --first-parent -m' '
698-
cat >expect <<-\EOF &&
699-
stash@{0}: WIP on master: b27a2bc subdir
698+
cat >expect <<-EOF &&
699+
stash@{0}
700700
701701
diff --git a/file b/file
702702
index 257cc56..d26b33d 100644
@@ -706,13 +706,13 @@ test_expect_success 'stash list implies --first-parent -m' '
706706
-foo
707707
+working
708708
EOF
709-
git stash list -p >actual &&
709+
git stash list --format=%gd -p >actual &&
710710
test_cmp expect actual
711711
'
712712

713713
test_expect_success 'stash list --cc shows combined diff' '
714714
cat >expect <<-\EOF &&
715-
stash@{0}: WIP on master: b27a2bc subdir
715+
stash@{0}
716716
717717
diff --cc file
718718
index 257cc56,9015a7a..d26b33d
@@ -723,7 +723,7 @@ test_expect_success 'stash list --cc shows combined diff' '
723723
-index
724724
++working
725725
EOF
726-
git stash list -p --cc >actual &&
726+
git stash list --format=%gd -p --cc >actual &&
727727
test_cmp expect actual
728728
'
729729

0 commit comments

Comments
 (0)