Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-03 02:58:36 +0400
committerJunio C Hamano <gitster@pobox.com>2011-05-03 02:58:36 +0400
commit0d405d72f5ffb499b40dd3a95886ae5a1fc13b30 (patch)
tree5508dff285aa24e08475eae9b2d7380800881e45 /git-submodule.sh
parent2d23c64ba2e91029f4ce932117a1772378d63cf3 (diff)
parent9db31bdf5c834689c826f809d6d15bf7ab8d3598 (diff)
Merge branch 'nm/submodule-update-force'
* nm/submodule-update-force: submodule: Add --force option for git submodule update Conflicts: t/t7406-submodule-update.sh
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index b010a67309..bf110e9cb7 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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"
;;