@matheusbsbs / matheus-bagliano / commits / fe249b4219
Fork 0

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>

Martin von Zweigbergk committed Nov 13, 2010 at 23:58 UTC fe249b4219f66ae3aacfac50ad19b38c370ad115
2 files changed +15 -2
git-parse-remote.sh
+8 -2
@@ -89,7 +89,13 @@ get_remote_merge_branch () {
89 refs/heads/*) remote=${remote#refs/heads/} ;;
90 refs/* | tags/* | remotes/* ) remote=
91 esac
92 -
93 - [ -n "$remote" ] && echo "refs/remotes/$repo/$remote"
92 + [ -n "$remote" ] && case "$repo" in
93 + .)
94 + echo "refs/heads/$remote"
95 + ;;
96 + *)
97 + echo "refs/remotes/$repo/$remote"
98 + ;;
99 + esac
100 esac
101 }
t/t5520-pull.sh
+7
@@ -222,4 +222,11 @@ test_expect_success 'git pull --rebase does not reapply old patches' '
222 )
223 '
224
225 +test_expect_success 'git pull --rebase against local branch' '
226 + git checkout -b copy2 to-rebase-orig &&
227 + git pull --rebase . to-rebase &&
228 + test "conflicting modification" = "$(cat file)" &&
229 + test file = "$(cat file2)"
230 +'
231 +
232 test_done