Re: [PATCHv2 2/2] pull: support rebased upstream + fetch + pull --rebase
From: Santi Béjar <hidden>
Date: 2016-06-15 22:47:04
2009/7/16 Junio C Hamano [off-list ref]:
Johannes Schindelin [off-list ref] writes:quoted
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. When you have Y---X / B---o---o---o---H wouldn't "rev-list --boundary H --not X^@" give B, not X nor Y?
$git rev-list --boundary H --not X
and
$git rev-list --boundary H --not X^@
return the same output in this case:
o
o
o
-B
In this case the correct command is without ^@, because you want the
commits in the reflog as boundary commits.
In the simpler and usual case, without a rebased upstream:
z---B---o---o---o---H
B=upstream@{0}
$git rev-list --boundary H --not B^@
o
o
o
B
-z
and:
$git rev-list --boundary H --not B
o
o
o
-B
Also in the rebased upstream case:
Y---X
/
z---B---o---o---o---H
X=upstream@{0}
B=upstream@{1}
$git rev-list --boundary H --not X^@ B^@
o
o
o
B
-z
and:
$git rev-list --boundary H --not X B
o
o
o
-B
HTH,
Santi