summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 97af7ff)
raw | patch | inline | side by side (parent: 97af7ff)
author | Santi Béjar <santi@agolina.net> | |
Thu, 11 Jun 2009 22:39:19 +0000 (00:39 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 12 Jun 2009 02:50:34 +0000 (19:50 -0700) |
Expand get_remote_merge_branch to compute the tracking branch to merge
when called without arguments (or only the remote name). This allows
"git pull --rebase" without arguments (default upstream branch) to
work with a rebased upstream. With explicit arguments it already worked.
Also add a test to check for this case.
Signed-off-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
when called without arguments (or only the remote name). This allows
"git pull --rebase" without arguments (default upstream branch) to
work with a rebased upstream. With explicit arguments it already worked.
Also add a test to check for this case.
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 | |
t/t5520-pull.sh | patch | blob | history |
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index a991564b95894f322ed4ac4a4a99ecd19a5fb817..75e12546400a24b8c06558b085be3465fbd15200 100755 (executable)
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
get_remote_merge_branch () {
case "$#" in
0|1)
- die "internal error: get-remote-merge-branch." ;;
+ origin="$1"
+ default=$(get_default_remote)
+ test -z "$origin" && origin=$default
+ curr_branch=$(git symbolic-ref -q HEAD)
+ [ "$origin" = "$default" ] &&
+ echo $(git for-each-ref --format='%(upstream)' $curr_branch)
+ ;;
*)
repo=$1
shift
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 725771fac167ea5aac8cf65b916c96918b0f5e0d..c5a2e66a09b9a871fb97142a58de51097a685ae0 100755 (executable)
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
git remote add -f me . &&
git checkout copy &&
+ git tag copy-orig &&
git reset --hard HEAD^ &&
echo conflicting modification > file &&
git commit -m conflict file &&
git checkout to-rebase &&
echo file > file2 &&
git commit -m to-rebase file2 &&
+ git tag to-rebase-orig &&
git pull --rebase me copy &&
test "conflicting modification" = "$(cat file)" &&
test file = $(cat file2)
'
+test_expect_success '--rebase with rebased default upstream' '
+
+ git update-ref refs/remotes/me/copy copy-orig &&
+ git checkout --track -b to-rebase2 me/copy &&
+ git reset --hard to-rebase-orig &&
+ git pull --rebase &&
+ test "conflicting modification" = "$(cat file)" &&
+ test file = $(cat file2)
+
+'
+
test_expect_success 'pull --rebase dies early with dirty working directory' '
+ git checkout to-rebase &&
git update-ref refs/remotes/me/copy copy^ &&
COPY=$(git rev-parse --verify me/copy) &&
git rebase --onto $COPY copy &&