X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-submodule.sh;h=8e234a4028d22e11baedba11f871d33f56945716;hb=dff2b6d4842eef0a03a3c8b3761f72e2b55b609e;hp=7c2e060ae770710ed7ed27d0aed4cfd2e8145810;hpb=2254da06a5473ffde973337bad2c6a96eea61e20;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index 7c2e060ae..8e234a402 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -204,8 +204,15 @@ cmd_add() else module_clone "$path" "$realrepo" || exit - (unset GIT_DIR; cd "$path" && git checkout -f -q ${branch:+-b "$branch" "origin/$branch"}) || - die "Unable to checkout submodule '$path'" + ( + unset GIT_DIR + cd "$path" && + # ash fails to wordsplit ${branch:+-b "$branch"...} + case "$branch" in + '') git checkout -f -q ;; + ?*) git checkout -f -q -b "$branch" "origin/$branch" ;; + esac + ) || die "Unable to checkout submodule '$path'" fi git add "$path" ||