From: "Santi Béjar" <santi@agolina.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCHv2 2/2] pull: support rebased upstream + fetch + pull --rebase
Date: Fri, 17 Jul 2009 15:24:21 +0200 [thread overview]
Message-ID: <adf1fd3d0907170624t7c2bf8f5w35c03788fdd82422@mail.gmail.com> (raw)
In-Reply-To: <7vr5wf67iz.fsf@alter.siamese.dyndns.org>
2009/7/17 Junio C Hamano <gitster@pobox.com>:
> Santi Béjar <santi@agolina.net> writes:
>
>> 2009/7/17 Santi Béjar <santi@agolina.net>:
>>> 2009/7/16 Junio C Hamano <gitster@pobox.com>:
>>>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>>>
>>>>> How about
>>>>>
>>>>> oldremoteref="$(git rev-list --boundary HEAD --not \
>>>>> $(git rev-list -g $remoteref | sed 's/$/^@/') |
>>>>> sed -e '/^[^-]/d' -e q)"
>>>>>
>>>>> Explanation: the "git rev-list -g $remoteref" lists the previous commits
>>>>> the remote ref pointed to, and the ^@ appended to them means all their
>>>>> parents. Now, the outer rev-list says to take everything in HEAD but
>>>>> _not_ in those parents, showing the boundary commits. The "sed" call
>>>>> lists the first such boundary commit (which must, by construction, be one
>>>>> of the commits shown by the first rev-list).
>>>>
>>>> Hmm, I am not sure about that "(which must..." part.
>>
>> Unfortunatly you are right with the "(which must..." part. Even
>> without the ^@. Normally gives the right answer, but it is not
>> sure that the first commit boundary is the correct one. For
>> example:
>>
>> o--C
>> /
>> A--x--y--B--o--z
>> \ /
>> o----o
>>
>> A, B, C are upstream@{n}
>>
>> It involves a merge with a branch forked before the fork commit
>> for the current branch, and it will not work neither with git
>> pull --rebase. We could say that it is not supported, but
>> nevertheless it gives the wrong answer.
>>
>> The right answer is B, but:
>> $ git rev-list --boundary z --not C B A
>> z
>> o
>> o
>> o
>> -x
>> -B
>
> Now a short question. Does your original loop give a correct answer in
> this case?
Yes, it returns B. But there are other cases where there is not a single right
answer if you allow merges. For the moment the more sensible thing to do is to
not allow merges in the local commits. I hope nobody relies on "git pull
--rebase" with local merges.
Just an example:
E
/
D----a topic2
/ \
A--B--C--b--c--d--topic1
A, B, C, D, E are upstream@{n} (n = 4,3,2,1,0)
if you are on branch "topic1", and run "git pull --rebase" you would want to
rebase only b, c and d (maybe "a" but you should not), but for sure not D.
And my algorithm returns C, but a more "correct" answer would be C and D.
Another possibility could be to check that there is only one boundary
commit (only one fork point for all the local commits).
Wait! Let's return to the original problem. The original problem is that you
cannot do a "git pull --rebase" with a rebased upstream if you have already
done "git fetch" before. And the solution would be:
Try to behaved as if the "git fetch" was not run.
And this is exactly what my patch does.
All the other "problems" happens already.
Now I only have to solve the "git rev-parse -q --verify upstream@{large_n}"
problem or workaround it.
Sometimes thinks aloud,
Santi
next prev parent reply other threads:[~2009-07-17 13:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 0:09 [PATCH 1/2] t5520-pull: Test for rebased upstream + fetch + pull --rebase Santi Béjar
2009-07-16 0:09 ` [PATCH 2/2] pull: support " Santi Béjar
2009-07-16 0:26 ` Junio C Hamano
2009-07-16 6:29 ` Santi Béjar
2009-07-16 8:12 ` [PATCHv2 " Santi Béjar
2009-07-16 8:12 ` Santi Béjar
2009-07-16 8:15 ` Santi Béjar
2009-07-16 8:51 ` Johannes Schindelin
2009-07-16 16:32 ` Santi Béjar
2009-07-17 10:13 ` Johannes Schindelin
2009-07-16 20:41 ` Junio C Hamano
2009-07-16 23:18 ` Santi Béjar
2009-07-17 7:51 ` Santi Béjar
2009-07-17 8:25 ` Junio C Hamano
2009-07-17 13:24 ` Santi Béjar [this message]
2009-07-18 13:46 ` [PATCHv3 " Santi Béjar
2009-07-18 17:55 ` Junio C Hamano
2009-07-19 7:27 ` Santi Béjar
2009-07-19 7:45 ` [PATCHv4 " Santi Béjar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adf1fd3d0907170624t7c2bf8f5w35c03788fdd82422@mail.gmail.com \
--to=santi@agolina.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).