Skip to content

Commit 7c8224b

Browse files
dschogitster
authored andcommitted
t3702: fix reliance on SHELL_PATH being '/bin/sh'
Trying to be lazy and comparing files with fake-editor.sh to avoid having to provide another example text does not work well: the blob name changes when SHELL_PATH changes, and so does the 'index' line in the diff. Therefore provide a second example text. Noticed by Mike Ralphson. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c59cb03 commit 7c8224b

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

t/t3702-add-edit.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ who house by the whale-path, heard his mandate,
2121
gave him gifts: a good king he!
2222
EOF
2323

24+
cat > second-part << EOF
25+
To him an heir was afterward born,
26+
a son in his halls, whom heaven sent
27+
to favor the folk, feeling their woe
28+
that erst they had lacked an earl for leader
29+
so long a while; the Lord endowed him,
30+
the Wielder of Wonder, with world's renown.
31+
EOF
32+
2433
test_expect_success 'setup' '
2534
2635
git add file &&
@@ -31,10 +40,10 @@ test_expect_success 'setup' '
3140

3241
cat > expected-patch << EOF
3342
diff --git a/file b/file
34-
index b9834b5..0b8f197 100644
43+
index b9834b5..9020acb 100644
3544
--- a/file
3645
+++ b/file
37-
@@ -1,11 +1,3 @@
46+
@@ -1,11 +1,6 @@
3847
-LO, praise of the prowess of people-kings
3948
-of spear-armed Danes, in days long sped,
4049
-we have heard, and what honor the athelings won!
@@ -46,9 +55,12 @@ index b9834b5..0b8f197 100644
4655
-till before him the folk, both far and near,
4756
-who house by the whale-path, heard his mandate,
4857
-gave him gifts: a good king he!
49-
+#!$SHELL_PATH
50-
+mv -f "\$1" orig-patch &&
51-
+mv -f patch "\$1"
58+
+To him an heir was afterward born,
59+
+a son in his halls, whom heaven sent
60+
+to favor the folk, feeling their woe
61+
+that erst they had lacked an earl for leader
62+
+so long a while; the Lord endowed him,
63+
+the Wielder of Wonder, with world's renown.
5264
EOF
5365

5466
cat > patch << EOF
@@ -97,9 +109,9 @@ chmod a+x fake-editor.sh
97109

98110
test_expect_success 'add -e' '
99111
100-
cp fake-editor.sh file &&
112+
cp second-part file &&
101113
git add -e &&
102-
test_cmp fake-editor.sh file &&
114+
test_cmp second-part file &&
103115
test_cmp orig-patch expected-patch &&
104116
git diff --cached > out &&
105117
test_cmp out expected

0 commit comments

Comments
 (0)