summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cb9d398)
raw | patch | inline | side by side (parent: cb9d398)
author | Santi Béjar <santi@agolina.net> | |
Thu, 11 Jun 2009 22:39:18 +0000 (00:39 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 12 Jun 2009 02:49:59 +0000 (19:49 -0700) |
The only user of get_remote_refs_for_fetch was "git pull --rebase" and
it only wanted the tracking branch to be merge. So, add a simple
function (get_remote_merge_branch) with this new meaning.
No behavior changes. The new function behaves like the old code in
"git pull --rebase". In particular, it only works with the default
refspec mapping and with remote branches, not tags.
Signed-off-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
it only wanted the tracking branch to be merge. So, add a simple
function (get_remote_merge_branch) with this new meaning.
No behavior changes. The new function behaves like the old code in
"git pull --rebase". In particular, it only works with the default
refspec mapping and with remote branches, not tags.
Signed-off-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-parse-remote.sh | patch | blob | history | |
git-pull.sh | patch | blob | history |
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index a296719861ec3b7aab5e530e67dc99b58267a56a..a991564b95894f322ed4ac4a4a99ecd19a5fb817 100755 (executable)
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
esac
}
+get_remote_merge_branch () {
+ case "$#" in
+ 0|1)
+ die "internal error: get-remote-merge-branch." ;;
+ *)
+ repo=$1
+ shift
+ ref=$1
+ # FIXME: It should return the tracking branch
+ # Currently only works with the default mapping
+ case "$ref" in
+ +*)
+ ref=$(expr "z$ref" : 'z+\(.*\)')
+ ;;
+ esac
+ expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:"
+ remote=$(expr "z$ref" : 'z\([^:]*\):')
+ case "$remote" in
+ '' | HEAD ) remote=HEAD ;;
+ heads/*) remote=${remote#heads/} ;;
+ refs/heads/*) remote=${remote#refs/heads/} ;;
+ refs/* | tags/* | remotes/* ) remote=
+ esac
+
+ [ -n "$remote" ] && echo "refs/remotes/$repo/$remote"
+ esac
+}
+
resolve_alternates () {
# original URL (xxx.git)
top_=`expr "z$1" : 'z\([^:]*:/*[^/]*\)/'`
;;
esac
}
+
diff --git a/git-pull.sh b/git-pull.sh
index 35261539ab80ffa46fef945dce1a82c5636c1b49..3cf26634adbc3cb2a7d63b4f03cfac7e8fd96f59 100755 (executable)
--- a/git-pull.sh
+++ b/git-pull.sh
die "refusing to pull with rebase: your working tree is not up-to-date"
. git-parse-remote &&
- origin="$1"
- test -z "$origin" && origin=$(get_default_remote)
- reflist="$(get_remote_refs_for_fetch "$@" 2>/dev/null |
- sed "s|refs/heads/\(.*\):|\1|")" &&
+ reflist="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
oldremoteref="$(git rev-parse -q --verify \
- "refs/remotes/$origin/$reflist")"
+ "$reflist")"
}
orig_head=$(git rev-parse -q --verify HEAD)
git fetch $verbosity --update-head-ok "$@" || exit 1