diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-08-10 12:33:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-10 12:33:20 -0700 |
commit | 11b53957ac81dc31668a1d8fe65d19d5f60dd501 (patch) | |
tree | e479fc638095c27aabc0245df55b7771b215bbd3 /git-submodule.sh | |
parent | 1a5f1a3f256a53014e5b832e1281d952ec5f9ef7 (diff) | |
parent | 967d7f898c30bad41824c3f77962266b7cd7be32 (diff) | |
download | git-11b53957ac81dc31668a1d8fe65d19d5f60dd501.tar.gz |
Merge branch 'sb/submodule-update-dot-branch'
A few updates to "git submodule update".
Use of "| wc -l" break with BSD variant of 'wc'.
* sb/submodule-update-dot-branch:
t7406: fix breakage on OSX
submodule update: allow '.' for branch value
submodule--helper: add remote-branch helper
submodule-config: keep configured branch around
submodule--helper: fix usage string for relative-path
submodule update: narrow scope of local variable
submodule update: respect depth in subsequent fetches
t7406: future proof tests with hard coded depth
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index c90dc335d1..b57f87de65 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -479,7 +479,8 @@ fetch_in_submodule () ( '') git fetch ;; *) - git fetch $(get_default_remote) "$2" ;; + shift + git fetch $(get_default_remote) "$@" ;; esac ) @@ -588,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 @@ -614,10 +614,11 @@ cmd_update() if test -n "$remote" then + branch=$(git submodule--helper remote-branch "$sm_path") if test -z "$nofetch" then # Fetch remote before determining tracking $sha1 - fetch_in_submodule "$sm_path" || + fetch_in_submodule "$sm_path" $depth || die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")" fi remote_name=$(sanitize_submodule_env; cd "$sm_path" && get_default_remote) @@ -640,13 +641,13 @@ cmd_update() # Run fetch only if $sha1 isn't present or it # is not reachable from a ref. is_tip_reachable "$sm_path" "$sha1" || - fetch_in_submodule "$sm_path" || + fetch_in_submodule "$sm_path" $depth || die "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")" # Now we tried the usual fetch, but $sha1 may # not be reachable from any of the refs is_tip_reachable "$sm_path" "$sha1" || - fetch_in_submodule "$sm_path" "$sha1" || + fetch_in_submodule "$sm_path" $depth "$sha1" || die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain \$sha1. Direct fetching of that commit failed.")" fi |