Merge branch 'ff/submodule-no-fetch'

* ff/submodule-no-fetch:
  submodule: add --no-fetch parameter to update command
This commit is contained in:
Junio C Hamano 2009-02-15 01:44:20 -08:00
commit 7b83a92431
2 changed files with 22 additions and 4 deletions

View File

@ -12,7 +12,7 @@ SYNOPSIS
'git submodule' [--quiet] add [-b branch] [--] <repository> <path>
'git submodule' [--quiet] status [--cached] [--] [<path>...]
'git submodule' [--quiet] init [--] [<path>...]
'git submodule' [--quiet] update [--init] [--] [<path>...]
'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--] [<path>...]
'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
'git submodule' [--quiet] foreach <command>
'git submodule' [--quiet] sync [--] [<path>...]
@ -172,6 +172,11 @@ OPTIONS
(the default). This limit only applies to modified submodules. The
size is always limited to 1 for added/deleted/typechanged submodules.
-N::
--no-fetch::
This option is only valid for the update command.
Don't fetch new objects from the remote site.
<path>...::
Paths to submodule(s). When specified this will restrict the command
to only operate on the submodules found at the specified paths.

View File

@ -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,7 +350,15 @@ cmd_update()
then
force="-f"
fi
(unset GIT_DIR; cd "$path" && git-fetch &&
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'"