From: Junio C Hamano Date: Wed, 19 Jan 2011 16:25:41 +0000 (-0800) Subject: Merge branch 'jn/submodule-b-current' into maint X-Git-Tag: v1.7.4-rc3~5^2~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f326a06497c6609b109c35bab6d8187b02dad81f?ds=inline;hp=-c Merge branch 'jn/submodule-b-current' into maint * jn/submodule-b-current: git submodule: Remove now obsolete tests before cloning a repo git submodule -b ... of current HEAD fails --- f326a06497c6609b109c35bab6d8187b02dad81f diff --combined git-submodule.sh index c291eed59c,a84418f1aa..6af1f7e7fd --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -93,20 -93,6 +93,6 @@@ module_clone( url=$2 reference="$3" - # If there already is a directory at the submodule path, - # expect it to be empty (since that is the default checkout - # action) and try to remove it. - # Note: if $path is a symlink to a directory the test will - # succeed but the rmdir will fail. We might want to fix this. - if test -d "$path" - then - rmdir "$path" 2>/dev/null || - die "Directory '$path' exists, but is neither empty nor a git repository" - fi - - test -e "$path" && - die "A file already exist at path '$path'" - if test -n "$reference" then git-clone "$reference" -n "$url" "$path" @@@ -241,7 -227,7 +227,7 @@@ cmd_add( # ash fails to wordsplit ${branch:+-b "$branch"...} case "$branch" in '') git checkout -f -q ;; - ?*) git checkout -f -q -b "$branch" "origin/$branch" ;; + ?*) git checkout -f -q -B "$branch" "origin/$branch" ;; esac ) || die "Unable to checkout submodule '$path'" fi @@@ -836,12 -822,11 +822,12 @@@ cmd_sync( ;; esac + say "Synchronizing submodule url for '$name'" + git config submodule."$name".url "$url" + if test -e "$path"/.git then ( - say "Synchronizing submodule url for '$name'" - git config submodule."$name".url "$url" clear_local_git_env cd "$path" remote=$(get_default_remote)