summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2a79d2f)
raw | patch | inline | side by side (parent: 2a79d2f)
author | Ping Yin <pkufranky@gmail.com> | |
Fri, 26 Sep 2008 15:33:23 +0000 (23:33 +0800) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 29 Sep 2008 15:24:19 +0000 (08:24 -0700) |
Since commit 55218("checkout: do not lose staged removal"), in
cmd_add/cmd_update, "git checkout <commit>" following
"git clone -n" may fail if <commit> is different from HEAD.
So Use "git checkout -f <commit>" to fix this.
Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
cmd_add/cmd_update, "git checkout <commit>" following
"git clone -n" may fail if <commit> is different from HEAD.
So Use "git checkout -f <commit>" to fix this.
Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-submodule.sh | patch | blob | history |
diff --git a/git-submodule.sh b/git-submodule.sh
index b40f876a2ca9fe985cedc622ab28a9f461edc5ab..5888735e4f2dac852f43c31195f430a1a6d23446 100755 (executable)
--- a/git-submodule.sh
+++ b/git-submodule.sh
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
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'"