summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Stefan Beller <sbeller@google.com>2017-01-11 10:47:32 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-13 12:02:51 -0800
commit3290fe6dd2a7e2bb35ac760443335dec58802ff1 (patch)
tree7df89dad28ec8b08875395265a3f2e13ba180174 /t
parentFifth batch 2.12 (diff)
downloadtgif-3290fe6dd2a7e2bb35ac760443335dec58802ff1.tar.xz
lib-submodule-update.sh: reduce use of subshell by using "git -C"
We write (cd <dir> && git <cmd>) to avoid cd <dir> && git <cmd> && cd .. that allows a breakage in one part of the test script to leave the entire test process in an unexpected place. Modern version of Git allows us to do this more concisely with "git -C <dir> <cmd>". Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/lib-submodule-update.sh5
1 files changed, 1 insertions, 4 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index 79cdd34a54..915eb4a7c6 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -69,10 +69,7 @@ create_lib_submodule_repo () {
git checkout -b "replace_sub1_with_directory" "add_sub1" &&
git submodule update &&
- (
- cd sub1 &&
- git checkout modifications
- ) &&
+ git -C sub1 checkout modifications &&
git rm --cached sub1 &&
rm sub1/.git* &&
git config -f .gitmodules --remove-section "submodule.sub1" &&