X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=git-submodule.sh;h=97e4d9a1ef9478f54613144e74e9e12314230877;hb=fa711bc1983efca058ef6af19ffa808690b21d8c;hp=b40f876a2ca9fe985cedc622ab28a9f461edc5ab;hpb=a0653d550524a0263d36fde6a8cf98941dd057ab;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index b40f876a2..97e4d9a1e 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -185,7 +185,7 @@ cmd_add() else module_clone "$path" "$realrepo" || exit - (unset GIT_DIR; cd "$path" && git checkout -q ${branch:+-b "$branch" "origin/$branch"}) || + (unset GIT_DIR; cd "$path" && git checkout -f -q ${branch:+-b "$branch" "origin/$branch"}) || die "Unable to checkout submodule '$path'" fi @@ -294,7 +294,7 @@ cmd_update() # Only mention uninitialized submodules when its # path have been specified test "$#" != "0" && - say "Submodule path '$path' not initialized" + say "Submodule path '$path' not initialized" && say "Maybe you want to use 'update --init'?" continue fi @@ -311,8 +311,13 @@ cmd_update() if test "$subsha1" != "$sha1" then + force= + if test -z "$subsha1" + then + force="-f" + fi (unset GIT_DIR; cd "$path" && git-fetch && - git-checkout -q "$sha1") || + git-checkout $force -q "$sha1") || die "Unable to checkout '$sha1' in submodule path '$path'" say "Submodule path '$path': checked out '$sha1'"