{"thread":{"id":"19702","subject":"[PATCH 2/3] pull --rebase: Add support for rebased default upstream","startedAt":"2009-06-05T19:53:36Z","lastAt":"2009-06-06T08:00:18Z","messageCount":3,"participants":["Santi Béjar","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"115554","messageId":"1244231617-17754-2-git-send-email-santi@agolina.net","threadId":"19702","inReplyTo":null,"subject":"[PATCH 2/3] pull --rebase: Add support for rebased default upstream","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-05T19:53:36Z","receivedAt":"2009-06-05T19:53:36Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"Also add a test to check for this case and another one (failing) to\ntest rebasing two branches on top of a rebased upstream using just\n'git pull --rebase'.\n\nSigned-off-by: Santi Béjar <santi@agolina.net>\n---\n git-parse-remote.sh |    8 +++++++-\n t/t5520-pull.sh     |   29 +++++++++++++++++++++++++++++\n 2 files changed, 36 insertions(+), 1 deletions(-)\n\ndiff --git a/git-parse-remote.sh b/git-parse-remote.sh\nindex 8b3ba72..5df5689 100644\n--- a/git-parse-remote.sh\n+++ b/git-parse-remote.sh\n@@ -232,7 +232,13 @@ get_remote_refs_for_fetch () {\n get_remote_merge_branch () {\n \tcase \"$#\" in\n \t0|1)\n-\t    die \"internal error: get-remote-merge-branch.\" ;;\n+\t    origin=\"$1\"\n+\t    default=$(get_default_remote)\n+\t    test -z \"$origin\" && origin=$default\n+\t    curr_branch=$(git symbolic-ref -q HEAD)\n+\t    [ \"$origin\" = \"$default\" ] &&\n+\t    echo $(git for-each-ref --format='%(upstream)' $curr_branch)\n+\t    ;;\n \t*)\n \t    repo=$1\n \t    shift\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 725771f..359a3e2 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -92,20 +92,49 @@ test_expect_success '--rebase with rebased upstream' '\n \n \tgit remote add -f me . &&\n \tgit checkout copy &&\n+\tgit tag copy-orig &&\n \tgit reset --hard HEAD^ &&\n \techo conflicting modification > file &&\n \tgit commit -m conflict file &&\n \tgit checkout to-rebase &&\n \techo file > file2 &&\n \tgit commit -m to-rebase file2 &&\n+\tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = $(cat file2)\n \n '\n \n+test_expect_success '--rebase with rebased default upstream' '\n+\n+\tgit update-ref refs/remotes/me/copy copy-orig &&\n+\tgit checkout --track -b to-rebase2 me/copy &&\n+\tgit reset --hard to-rebase-orig &&\n+\tgit pull --rebase &&\n+\ttest \"conflicting modification\" = \"$(cat file)\" &&\n+\ttest file = $(cat file2)\n+\n+'\n+\n+test_expect_failure '--rebase with rebased upstream and two branches' '\n+\n+\tgit update-ref refs/remotes/me/copy copy-orig &&\n+\tgit reset --hard to-rebase-orig &&\n+\tgit checkout --track -b to-rebase3 me/copy &&\n+\tgit reset --hard to-rebase-orig &&\n+\tgit pull --rebase &&\n+\ttest \"conflicting modification\" = \"$(cat file)\" &&\n+\ttest file = $(cat file2) &&\n+\tgit checkout to-rebase2 &&\n+\tgit pull --rebase me copy\n+\n+'\n+\n test_expect_success 'pull --rebase dies early with dirty working directory' '\n \n+\tgit rebase --abort &&\n+\tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n \tCOPY=$(git rev-parse --verify me/copy) &&\n \tgit rebase --onto $COPY copy &&\n-- \n1.6.3.1.308.g426b5\n"},{"id":"115571","messageId":"alpine.DEB.1.00.0906060120140.26154@pacific.mpi-cbg.de","threadId":"19702","inReplyTo":"1244231617-17754-2-git-send-email-santi@agolina.net","subject":"Re: [PATCH 2/3] pull --rebase: Add support for rebased default upstream","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-06-05T23:22:19Z","receivedAt":"2009-06-05T23:22:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 5 Jun 2009, Santi Béjar wrote:\n\n> Also add a test to check for this case and another one (failing) to\n> test rebasing two branches on top of a rebased upstream using just\n> 'git pull --rebase'.\n> \n> Signed-off-by: Santi Béjar <santi@agolina.net>\n\nEither I am a stupid moron (which is a completely valid suggestion) or \nthis commit message lacks in detail severely.\n\nFor example, when I \"git pull --rebase junio next\" and \"next\" was rebased, \nit works _perfectly_, so I do not see any need for a fix.\n\nFurther, this:\n\n> ---\n>  git-parse-remote.sh |    8 +++++++-\n>  t/t5520-pull.sh     |   29 +++++++++++++++++++++++++++++\n>  2 files changed, 36 insertions(+), 1 deletions(-)\n\n... suggests to me that pull --rebase is not even affected by your patch.  \nSo maybe you want to clarify so much that even stupid morons understand \nwhat you want to achieve, and how.\n\nCiao,\nDscho"},{"id":"115611","messageId":"adf1fd3d0906060100vc04032eh6315d336ef619402@mail.gmail.com","threadId":"19702","inReplyTo":"alpine.DEB.1.00.0906060120140.26154@pacific.mpi-cbg.de","subject":"Re: [PATCH 2/3] pull --rebase: Add support for rebased default upstream","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-06T08:00:18Z","receivedAt":"2009-06-06T08:00:18Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/6 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Fri, 5 Jun 2009, Santi Béjar wrote:\n>\n>> Also add a test to check for this case and another one (failing) to\n>> test rebasing two branches on top of a rebased upstream using just\n>> 'git pull --rebase'.\n>>\n>> Signed-off-by: Santi Béjar <santi@agolina.net>\n>\n> Either I am a stupid moron (which is a completely valid suggestion) or\n> this commit message lacks in detail severely.\n>\n> For example, when I \"git pull --rebase junio next\" and \"next\" was rebased,\n> it works _perfectly_, so I do not see any need for a fix.\n\nIt is for the default upstream (with no arguments), so before this patch:\n\ngit pull --rebase\n\ndid not work with a rebased upstream.\n\nBut you are right, the commit message can be improved a lot. I've\nredone this patch series so much that at the end the commit message\nlack details.\n>\n> Further, this:\n>\n>> ---\n>>  git-parse-remote.sh |    8 +++++++-\n>>  t/t5520-pull.sh     |   29 +++++++++++++++++++++++++++++\n>>  2 files changed, 36 insertions(+), 1 deletions(-)\n>\n> ... suggests to me that pull --rebase is not even affected by your patch.\n\nIt modifies a function used in git pull --rebase.\n\n> So maybe you want to clarify so much that even stupid morons understand\n> what you want to achieve, and how.\n\nOK, I'll try.\n\nparse-remote: support default reflist in get_remote_merge_branch\n\nExpand get_remote_merge_branch to compute the tracking branch to merge\nwhen called without arguments (or only the remote name). This allows\n\"git pull --rebase\" without arguments (default upstream branch) to\nwork with a rebased upstream.\n\nSanti\n"}]}