t7610: cd inside subshell instead of around
Instead of using `cd dir && (...) && cd..` use `(cd dir && ...)` This ensures that the test doesn't get caught in the subdirectory if there is an error in the subshell. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Gernhardt committed
Aug 23, 2010 at 22:37 UTC
25641fcdb0d31130fadd649861035cc7db859cf7
1 file changed
+26
-23
t/t7610-mergetool.sh
+26
-23
@@ -68,22 +68,24 @@ test_expect_success 'mergetool crlf' '
68
'
69
70
test_expect_success 'mergetool in subdir' '
71
- git checkout -b test3 branch1
72
- cd subdir && (
73
- test_must_fail git merge master >/dev/null 2>&1 &&
74
- ( yes "" | git mergetool file3 >/dev/null 2>&1 ) &&
75
- test "$(cat file3)" = "master new sub") &&
76
- cd ..
71
+ git checkout -b test3 branch1 &&
72
+ (
73
+ cd subdir &&
74
+ test_must_fail git merge master >/dev/null 2>&1 &&
75
+ ( yes "" | git mergetool file3 >/dev/null 2>&1 ) &&
76
+ test "$(cat file3)" = "master new sub"
77
+ )
78
'
79
80
test_expect_success 'mergetool on file in parent dir' '
80
- cd subdir && (
81
- ( yes "" | git mergetool ../file1 >/dev/null 2>&1 ) &&
82
- ( yes "" | git mergetool ../file2 >/dev/null 2>&1 ) &&
83
- test "$(cat ../file1)" = "master updated" &&
84
- test "$(cat ../file2)" = "master new" &&
85
- git commit -m "branch1 resolved with mergetool - subdir") &&
86
- cd ..
81
+ (
82
+ cd subdir &&
83
+ ( yes "" | git mergetool ../file1 >/dev/null 2>&1 ) &&
84
+ ( yes "" | git mergetool ../file2 >/dev/null 2>&1 ) &&
85
+ test "$(cat ../file1)" = "master updated" &&
86
+ test "$(cat ../file2)" = "master new" &&
87
+ git commit -m "branch1 resolved with mergetool - subdir"
88
+ )
89
'
90
91
test_expect_success 'mergetool skips autoresolved' '
@@ -96,16 +98,17 @@ test_expect_success 'mergetool skips autoresolved' '
98
'
99
100
test_expect_success 'mergetool merges all from subdir' '
99
- cd subdir && (
100
- git config rerere.enabled false &&
101
- test_must_fail git merge master &&
102
- git mergetool --no-prompt &&
103
- test "$(cat ../file1)" = "master updated" &&
104
- test "$(cat ../file2)" = "master new" &&
105
- test "$(cat file3)" = "master new sub" &&
106
- git add ../file1 ../file2 file3 &&
107
- git commit -m "branch2 resolved by mergetool from subdir") &&
108
- cd ..
101
+ (
102
+ cd subdir &&
103
+ git config rerere.enabled false &&
104
+ test_must_fail git merge master &&
105
+ git mergetool --no-prompt &&
106
+ test "$(cat ../file1)" = "master updated" &&
107
+ test "$(cat ../file2)" = "master new" &&
108
+ test "$(cat file3)" = "master new sub" &&
109
+ git add ../file1 ../file2 file3 &&
110
+ git commit -m "branch2 resolved by mergetool from subdir"
111
+ )
112
'
113
114
test_done