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>
Johannes Schindelin committed
Apr 27, 2009 at 19:51 UTC
7c8224b6a8c16c84938ad7c31cb98e55cb1e8cfd
1 file changed
+19
-7
t/t3702-add-edit.sh
+19
-7
@@ -21,6 +21,15 @@ who house by the whale-path, heard his mandate,
21
gave him gifts: a good king he!
22
EOF
23
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
+
33
test_expect_success 'setup' '
34
35
git add file &&
@@ -31,10 +40,10 @@ test_expect_success 'setup' '
40
41
cat > expected-patch << EOF
42
diff --git a/file b/file
34
-index b9834b5..0b8f197 100644
43
+index b9834b5..9020acb 100644
44
--- a/file
45
+++ b/file
37
-@@ -1,11 +1,3 @@
46
+@@ -1,11 +1,6 @@
47
-LO, praise of the prowess of people-kings
48
-of spear-armed Danes, in days long sped,
49
-we have heard, and what honor the athelings won!
@@ -46,9 +55,12 @@ index b9834b5..0b8f197 100644
55
-till before him the folk, both far and near,
56
-who house by the whale-path, heard his mandate,
57
-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.
64
EOF
65
66
cat > patch << EOF
@@ -97,9 +109,9 @@ chmod a+x fake-editor.sh
109
110
test_expect_success 'add -e' '
111
100
- cp fake-editor.sh file &&
112
+ cp second-part file &&
113
git add -e &&
102
- test_cmp fake-editor.sh file &&
114
+ test_cmp second-part file &&
115
test_cmp orig-patch expected-patch &&
116
git diff --cached > out &&
117
test_cmp out expected