From 3290fe6dd2a7e2bb35ac760443335dec58802ff1 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Wed, 11 Jan 2017 10:47:32 -0800 Subject: [PATCH] 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 --- t/lib-submodule-update.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 79cdd34a540..915eb4a7c65 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" &&