Merge branch 'nm/submodule-update-force'

* nm/submodule-update-force:
  submodule: Add --force option for git submodule update

Conflicts:
	t/t7406-submodule-update.sh
This commit is contained in:
Junio C Hamano
2011-05-02 15:58:36 -07:00
3 changed files with 36 additions and 7 deletions

View File

@ -8,7 +8,7 @@ dashless=$(basename "$0" | sed -e 's/-/ /')
USAGE="[--quiet] add [-b branch] [-f|--force] [--reference <repository>] [--] <repository> [<path>]
or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: $dashless [--quiet] init [--] [<path>...]
or: $dashless [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
or: $dashless [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: $dashless [--quiet] foreach [--recursive] <command>
or: $dashless [--quiet] sync [--] [<path>...]"
@ -402,6 +402,9 @@ cmd_update()
-N|--no-fetch)
nofetch=1
;;
-f|--force)
force=$1
;;
-r|--rebase)
update="rebase"
;;
@ -480,10 +483,11 @@ cmd_update()
if test "$subsha1" != "$sha1"
then
force=
if test -z "$subsha1"
subforce=$force
# If we don't already have a -f flag and the submodule has never been checked out
if test -z "$subsha1" -a -z "$force"
then
force="-f"
subforce="-f"
fi
if test -z "$nofetch"
@ -515,7 +519,7 @@ cmd_update()
msg="merged in"
;;
*)
command="git checkout $force -q"
command="git checkout $subforce -q"
action="checkout"
msg="checked out"
;;