summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-09-29 11:04:20 -0700
committerShawn O. Pearce <spearce@spearce.org>2008-09-29 11:04:20 -0700
commit9800c0df412869c7949935b61581b9361fc49bd1 (patch)
tree837cb43f80452126e46ff5de641f14b7b349484f /git-submodule.sh
parent9ba929ed652f5ed7707f1c684999af4ad02c4925 (diff)
parent5a139ba483efea47e103fef47afe87157e3bba77 (diff)
downloadgit-9800c0df412869c7949935b61581b9361fc49bd1.tar.gz
Merge branch 'bc/master-diff-hunk-header-fix'
* bc/master-diff-hunk-header-fix: Clarify commit error message for unmerged files Use strchrnul() instead of strchr() plus manual workaround Use remove_path from dir.c instead of own implementation Add remove_path: a function to remove as much as possible of a path git-submodule: Fix "Unable to checkout" for the initial 'update' Clarify how the user can satisfy stash's 'dirty state' check. t4018-diff-funcname: test syntax of builtin xfuncname patterns t4018-diff-funcname: test syntax of builtin xfuncname patterns make "git remote" report multiple URLs diff hunk pattern: fix misconverted "\{" tex macro introducers diff: fix "multiple regexp" semantics to find hunk header comment diff: use extended regexp to find hunk headers diff: use extended regexp to find hunk headers diff.*.xfuncname which uses "extended" regex's for hunk header selection diff.c: associate a flag with each pattern and use it for compiling regex diff.c: return pattern entry pointer rather than just the hunk header pattern Conflicts: builtin-merge-recursive.c t/t7201-co.sh xdiff-interface.h
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 92be0feb58..65178ae8e3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -194,7 +194,7 @@ cmd_add()
else
module_clone "$path" "$realrepo" || exit
- (unset GIT_DIR; cd "$path" && git checkout -q ${branch:+-b "$branch" "origin/$branch"}) ||
+ (unset GIT_DIR; cd "$path" && git checkout -f -q ${branch:+-b "$branch" "origin/$branch"}) ||
die "Unable to checkout submodule '$path'"
fi
@@ -340,8 +340,13 @@ cmd_update()
if test "$subsha1" != "$sha1"
then
+ force=
+ if test -z "$subsha1"
+ then
+ force="-f"
+ fi
(unset GIT_DIR; cd "$path" && git-fetch &&
- git-checkout -q "$sha1") ||
+ git-checkout $force -q "$sha1") ||
die "Unable to checkout '$sha1' in submodule path '$path'"
say "Submodule path '$path': checked out '$sha1'"