summaryrefslogtreecommitdiff
path: root/git-fetch-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-23 05:52:43 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-08-24 23:50:53 (GMT)
commitefe9bf0f3b34d12b3b76f8277550f91700609b25 (patch)
tree50ecb933fd3117f7360eb7c5e9c481359d0f5abe /git-fetch-script
parent521003ff52d1cf742350e1342bc2dd4ab1b51e6b (diff)
downloadgit-efe9bf0f3b34d12b3b76f8277550f91700609b25.zip
git-efe9bf0f3b34d12b3b76f8277550f91700609b25.tar.gz
git-efe9bf0f3b34d12b3b76f8277550f91700609b25.tar.bz2
[PATCH] Allow "+remote:local" refspec to cause --force when fetching.
With this we could say: Pull: master:ko-master +pu:ko-pu to mean "fast forward ko-master with master, overwrite ko-pu with pu", and the latter one does not require the remote "pu" to be descendant of local "ko-pu". Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fetch-script')
-rwxr-xr-xgit-fetch-script18
1 files changed, 15 insertions, 3 deletions
diff --git a/git-fetch-script b/git-fetch-script
index dc7f4d6..d55cc85 100755
--- a/git-fetch-script
+++ b/git-fetch-script
@@ -104,8 +104,8 @@ fast_forward_local () {
;;
esac || {
echo >&2 "* $1: does not fast forward to $4"
- case "$force" in
- t)
+ case "$force,$single_force" in
+ t,* | *,t)
echo >&2 " from $3; forcing update."
;;
*)
@@ -130,6 +130,13 @@ do
# These are relative path from $GIT_DIR, typically starting at refs/
# but may be HEAD
+ if expr "$ref" : '\+' >/dev/null
+ then
+ single_force=t
+ ref=$(expr "$ref" : '\+\(.*\)')
+ else
+ single_force=
+ fi
remote_name=$(expr "$ref" : '\([^:]*\):')
local_name=$(expr "$ref" : '[^:]*:\(.*\)')
@@ -175,9 +182,14 @@ http://* | https://* | rsync://* )
while read sha1 remote_name
do
found=
+ single_force=
for ref in $refs
do
case "$ref" in
+ +$remote_name:*)
+ single_force=t
+ found="$ref"
+ break ;;
$remote_name:*)
found="$ref"
break ;;
@@ -185,7 +197,7 @@ http://* | https://* | rsync://* )
done
local_name=$(expr "$found" : '[^:]*:\(.*\)')
- append_fetch_head "$sha1" "$remote" "$remote_name" "$remote_nick" "$local_name"
+ append_fetch_head "$sha1" "$remote" "$remote_name" "$remote_nick" "$local_name"
done
;;
esac