* [PATCHv2] git-pull: Avoid merge-base on detached head
@ 2012-10-23 20:39 Phil Hord
2012-10-23 20:39 ` Phil Hord
0 siblings, 1 reply; 5+ messages in thread
From: Phil Hord @ 2012-10-23 20:39 UTC (permalink / raw
To: git; +Cc: phil.hord, Junio C Hamano
Add Signed-off-by...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCHv2] git-pull: Avoid merge-base on detached head
2012-10-23 20:39 [PATCHv2] git-pull: Avoid merge-base on detached head Phil Hord
@ 2012-10-23 20:39 ` Phil Hord
2012-10-25 9:34 ` Jeff King
0 siblings, 1 reply; 5+ messages in thread
From: Phil Hord @ 2012-10-23 20:39 UTC (permalink / raw
To: git; +Cc: phil.hord, Junio C Hamano, Phil Hord
git pull --rebase does some clever tricks to find the base
for $upstream , but it forgets that we may not have any
branch at all. When this happens, git merge-base reports its
"usage" help in the middle of an otherwise successful
rebase operation, because git-merge is called with one too
few parameters.
Since we do not need the merge-base trick in the case of a
detached HEAD, detect this condition and bypass the clever
trick and the usage noise.
Signed-off-by: Phil Hord <hordp@cisco.com>
---
git-pull.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/git-pull.sh b/git-pull.sh
index 2a10047..266e682 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -200,6 +200,7 @@ test true = "$rebase" && {
require_clean_work_tree "pull with rebase" "Please commit or stash them."
fi
oldremoteref= &&
+ test -n "$curr_branch" &&
. git-parse-remote &&
remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
--
1.8.0.2.gc921d59.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCHv2] git-pull: Avoid merge-base on detached head
2012-10-23 20:39 ` Phil Hord
@ 2012-10-25 9:34 ` Jeff King
2012-10-25 18:50 ` Phil Hord
0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2012-10-25 9:34 UTC (permalink / raw
To: Phil Hord; +Cc: git, phil.hord, Junio C Hamano
On Tue, Oct 23, 2012 at 04:39:56PM -0400, Phil Hord wrote:
> git pull --rebase does some clever tricks to find the base
> for $upstream , but it forgets that we may not have any
> branch at all. When this happens, git merge-base reports its
> "usage" help in the middle of an otherwise successful
> rebase operation, because git-merge is called with one too
> few parameters.
>
> Since we do not need the merge-base trick in the case of a
> detached HEAD, detect this condition and bypass the clever
> trick and the usage noise.
Makes sense. I notice there is no test with your patch. It sounds from
the description like the operation still may succeed, but we just get
cruft on stderr?
-Peff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] git-pull: Avoid merge-base on detached head
2012-10-25 9:34 ` Jeff King
@ 2012-10-25 18:50 ` Phil Hord
2012-10-26 12:48 ` Jeff King
0 siblings, 1 reply; 5+ messages in thread
From: Phil Hord @ 2012-10-25 18:50 UTC (permalink / raw
To: Jeff King; +Cc: git, phil.hord, Junio C Hamano
Jeff King wrote:
> On Tue, Oct 23, 2012 at 04:39:56PM -0400, Phil Hord wrote:
>
>> git pull --rebase does some clever tricks to find the base
>> for $upstream , but it forgets that we may not have any
>> branch at all. When this happens, git merge-base reports its
>> "usage" help in the middle of an otherwise successful
>> rebase operation, because git-merge is called with one too
>> few parameters.
>>
>> Since we do not need the merge-base trick in the case of a
>> detached HEAD, detect this condition and bypass the clever
>> trick and the usage noise.
> Makes sense. I notice there is no test with your patch. It sounds from
> the description like the operation still may succeed, but we just get
> cruft on stderr?
>
Yes, that's correct.
P
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] git-pull: Avoid merge-base on detached head
2012-10-25 18:50 ` Phil Hord
@ 2012-10-26 12:48 ` Jeff King
0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2012-10-26 12:48 UTC (permalink / raw
To: Phil Hord; +Cc: git, phil.hord, Junio C Hamano
On Thu, Oct 25, 2012 at 02:50:37PM -0400, Phil Hord wrote:
> >> git pull --rebase does some clever tricks to find the base
> >> for $upstream , but it forgets that we may not have any
> >> branch at all. When this happens, git merge-base reports its
> >> "usage" help in the middle of an otherwise successful
> >> rebase operation, because git-merge is called with one too
> >> few parameters.
> >>
> >> Since we do not need the merge-base trick in the case of a
> >> detached HEAD, detect this condition and bypass the clever
> >> trick and the usage noise.
> > Makes sense. I notice there is no test with your patch. It sounds from
> > the description like the operation still may succeed, but we just get
> > cruft on stderr?
> >
>
> Yes, that's correct.
OK. I'd rather not worry about a test then, as it would necessarily be
flaky with respect to what git-pull might generate on its stderr. I've
queued your patch in 'next'.
Thanks.
-Peff
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-26 12:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 20:39 [PATCHv2] git-pull: Avoid merge-base on detached head Phil Hord
2012-10-23 20:39 ` Phil Hord
2012-10-25 9:34 ` Jeff King
2012-10-25 18:50 ` Phil Hord
2012-10-26 12:48 ` Jeff King
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).