From: Stefan Beller Date: Wed, 11 Jan 2017 18:47:32 +0000 (-0800) Subject: lib-submodule-update.sh: reduce use of subshell by using "git -C" X-Git-Tag: v2.12.0-rc0~47^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3290fe6dd2a7e2bb35ac760443335dec58802ff1?hp=--cc lib-submodule-update.sh: reduce use of subshell by using "git -C" We write (cd && git ) to avoid cd && git && 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 ". Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- 3290fe6dd2a7e2bb35ac760443335dec58802ff1 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" &&