From: Stefan Beller Date: Fri, 16 Oct 2015 01:52:04 GMT Subject: [PATCH 03/12] git submodule update: Move branch calculation to where it's needed Message-ID: <1444960333-16003-4-git-send-email-sbeller@google.com> In-Reply-To: <1444960333-16003-1-git-send-email-sbeller@google.com> The branch variable is used only once so calculate it only when needed. Signed-off-by: Stefan Beller --- git-submodule.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-submodule.sh b/git-submodule.sh index eea27f8..56a0524 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -668,7 +668,6 @@ cmd_update() fi name=$(git submodule--helper name "$sm_path") || exit url=$(git config submodule."$name".url) - branch=$(get_submodule_config "$name" branch master) if ! test -z "$update" then update_module=$update @@ -718,6 +717,7 @@ Maybe you want to use 'update --init'?")" die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")" fi remote_name=$(clear_local_git_env; cd "$sm_path" && get_default_remote) + branch=$(get_submodule_config "$name" branch master) sha1=$(clear_local_git_env; cd "$sm_path" && git rev-parse --verify "${remote_name}/${branch}") || die "$(eval_gettext "Unable to find current ${remote_name}/${branch} revision in submodule path '\$sm_path'")" -- 2.5.0.277.gfdc362b.dirty