aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-03-20 22:11:02 -0700
committerJunio C Hamano <gitster@pobox.com>2011-03-20 22:11:02 -0700
commit106040fe8ecb670261f423c285d494d6d0170558 (patch)
tree6f0ea7f876baf20cfb74488de36979a16c08cc1f /git-submodule.sh
parenteec8a512bc957efac656921a5aeeaef23bd9f729 (diff)
parentb200021e150320459d4f1edf1099131e0f5ae297 (diff)
downloadgit-106040fe8ecb670261f423c285d494d6d0170558.tar.xz
Merge branch 'so/submodule-no-update-first-time' into maint
* so/submodule-no-update-first-time: t7406: "git submodule update {--merge|--rebase]" with new submodules submodule: no [--merge|--rebase] when newly cloned
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 8b90589717..3a13397e05 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -423,6 +423,7 @@ cmd_update()
cmd_init "--" "$@" || return
fi
+ cloned_modules=
module_list "$@" |
while read mode sha1 stage path
do
@@ -442,6 +443,7 @@ cmd_update()
if ! test -d "$path"/.git -o -f "$path"/.git
then
module_clone "$path" "$url" "$reference"|| exit
+ cloned_modules="$cloned_modules;$name"
subsha1=
else
subsha1=$(clear_local_git_env; cd "$path" &&
@@ -469,6 +471,13 @@ cmd_update()
die "Unable to fetch in submodule path '$path'"
fi
+ # Is this something we just cloned?
+ case ";$cloned_modules;" in
+ *";$name;"*)
+ # then there is no local change to integrate
+ update_module= ;;
+ esac
+
case "$update_module" in
rebase)
command="git rebase"