Browse Source

Use reflog in 'pull --rebase . foo'

Since c85c792 (pull --rebase: be cleverer with rebased upstream
branches, 2008-01-26), "git pull --rebase" has used the reflog to try to
rebase from the old upstream onto the new upstream.

Make this work if the local repository is explicitly passed on the
command line as in 'git pull --rebase . foo'.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Acked-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Martin von Zweigbergk 14 years ago committed by Junio C Hamano
parent
commit
fe249b4219
  1. 10
      git-parse-remote.sh
  2. 7
      t/t5520-pull.sh

10
git-parse-remote.sh

@ -89,7 +89,13 @@ get_remote_merge_branch () { @@ -89,7 +89,13 @@ get_remote_merge_branch () {
refs/heads/*) remote=${remote#refs/heads/} ;;
refs/* | tags/* | remotes/* ) remote=
esac

[ -n "$remote" ] && echo "refs/remotes/$repo/$remote"
[ -n "$remote" ] && case "$repo" in
.)
echo "refs/heads/$remote"
;;
*)
echo "refs/remotes/$repo/$remote"
;;
esac
esac
}

7
t/t5520-pull.sh

@ -222,4 +222,11 @@ test_expect_success 'git pull --rebase does not reapply old patches' ' @@ -222,4 +222,11 @@ test_expect_success 'git pull --rebase does not reapply old patches' '
)
'

test_expect_success 'git pull --rebase against local branch' '
git checkout -b copy2 to-rebase-orig &&
git pull --rebase . to-rebase &&
test "conflicting modification" = "$(cat file)" &&
test file = "$(cat file2)"
'

test_done

Loading…
Cancel
Save