From: Junio C Hamano Date: Fri, 16 Oct 2015 20:54:52 GMT Subject: Re: [PATCH 03/12] git submodule update: Move branch calculation to where it's needed Message-ID: In-Reply-To: <1444960333-16003-4-git-send-email-sbeller@google.com> Stefan Beller writes: > The branch variable is used only once so calculate it only when needed. > > Signed-off-by: Stefan Beller > --- Makes sense. > 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'")"