X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-submodule.sh;h=204aab671ef78edc24acff4019a2f40a71a59020;hb=161261b12b3777bc78ef3fbe84ccf595dd195704;hp=6cc2d334c08e1c3155c99087ca1e863400ffea23;hpb=c42b04bbb0cdf7618d3bdb57ed02569a5f128fe9;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index 6cc2d334c..204aab671 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -5,7 +5,7 @@ # Copyright (c) 2007 Lars Hjemli USAGE="[--quiet] [--cached] \ -[add [-b branch] ]|[status|init|update [-i|--init]|summary [-n|--summary-limit ] []] \ +[add [-b branch] ]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit ] []] \ [--] [...]|[foreach ]|[sync [--] [...]]" OPTIONS_SPEC= . git-sh-setup @@ -16,6 +16,7 @@ command= branch= quiet= cached= +nofetch= # # print stuff on stdout unless -q was specified @@ -300,6 +301,10 @@ cmd_update() shift cmd_init "$@" || return ;; + -N|--no-fetch) + shift + nofetch=1 + ;; --) shift break @@ -345,8 +350,16 @@ cmd_update() then force="-f" fi - (unset GIT_DIR; cd "$path" && git-fetch && - git-checkout $force -q "$sha1") || + + if test -z "$nofetch" + then + (unset GIT_DIR; cd "$path" && + git-fetch) || + die "Unable to fetch in submodule path '$path'" + fi + + (unset GIT_DIR; cd "$path" && + git-checkout $force -q "$sha1") || die "Unable to checkout '$sha1' in submodule path '$path'" say "Submodule path '$path': checked out '$sha1'"