X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-submodule.sh;h=97e4d9a1ef9478f54613144e74e9e12314230877;hb=ce2c3ebbc5a66e0370b3ab5b5611c2c390ddd6c0;hp=9228f56bee7fd82d530a6865f1f8669fd9b99d8f;hpb=547905f8cd2a04b3e1117f00025b60f81aa60f47;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index 9228f56be..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 @@ -264,6 +264,7 @@ cmd_update() do case "$1" in -q|--quiet) + shift quiet=1 ;; -i|--init) @@ -281,7 +282,6 @@ cmd_update() break ;; esac - shift done git ls-files --stage -- "$@" | grep '^160000 ' | @@ -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'"