submodule update: narrow scope of local variable
authorStefan Beller <sbeller@google.com>
Fri, 29 Jul 2016 00:44:05 +0000 (17:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2016 21:41:51 +0000 (14:41 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-submodule.sh
index 40639ee2310a300abe854c87f1e8a277344b3c67..41aff65fac2ec88534cb57c65931c0a26e6dfcf2 100755 (executable)
@@ -589,7 +589,6 @@ cmd_update()
 
                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
@@ -615,6 +614,7 @@ cmd_update()
 
                if test -n "$remote"
                then
+                       branch=$(get_submodule_config "$name" branch master)
                        if test -z "$nofetch"
                        then
                                # Fetch remote before determining tracking $sha1