summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-02-15 09:44:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-15 09:44:20 (GMT)
commit7b83a9243147a8cec4f556af1d29f2cc21c12518 (patch)
tree877612c40d73ff0d409fb7ad09aac76ca96e424a /git-submodule.sh
parent160d2bc35382fb23beb99457e9111d15554bf223 (diff)
parent31ca3ac30fe3c2583881a74ef346911c8fba478f (diff)
downloadgit-7b83a9243147a8cec4f556af1d29f2cc21c12518.zip
git-7b83a9243147a8cec4f556af1d29f2cc21c12518.tar.gz
git-7b83a9243147a8cec4f556af1d29f2cc21c12518.tar.bz2
Merge branch 'ff/submodule-no-fetch'
* ff/submodule-no-fetch: submodule: add --no-fetch parameter to update command
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 6cc2d33..204aab6 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -5,7 +5,7 @@
# Copyright (c) 2007 Lars Hjemli
USAGE="[--quiet] [--cached] \
-[add <repo> [-b branch] <path>]|[status|init|update [-i|--init]|summary [-n|--summary-limit <n>] [<commit>]] \
+[add <repo> [-b branch] <path>]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit <n>] [<commit>]] \
[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
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'"