{"thread":{"id":"31923","subject":"[PATCHv2] git-pull: Avoid merge-base on detached head","startedAt":"2012-10-23T20:39:55Z","lastAt":"2012-10-26T12:48:10Z","messageCount":5,"participants":["Phil Hord","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201750","messageId":"1351024796-28174-1-git-send-email-hordp@cisco.com","threadId":"31923","inReplyTo":null,"subject":"[PATCHv2] git-pull: Avoid merge-base on detached head","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-23T20:39:55Z","receivedAt":"2012-10-23T20:39:55Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"\nAdd Signed-off-by...\n"},{"id":"201749","messageId":"1351024796-28174-2-git-send-email-hordp@cisco.com","threadId":"31923","inReplyTo":"1351024796-28174-1-git-send-email-hordp@cisco.com","subject":"[PATCHv2] git-pull: Avoid merge-base on detached head","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-23T20:39:56Z","receivedAt":"2012-10-23T20:39:56Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"git pull --rebase does some clever tricks to find the base\nfor $upstream , but it forgets that we may not have any\nbranch at all.  When this happens, git merge-base reports its\n\"usage\" help in the middle of an otherwise successful\nrebase operation, because git-merge is called with one too\nfew parameters.\n\nSince we do not need the merge-base trick in the case of a\ndetached HEAD, detect this condition and bypass the clever\ntrick and the usage noise.\n\nSigned-off-by: Phil Hord <hordp@cisco.com>\n---\n git-pull.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 2a10047..266e682 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -200,6 +200,7 @@ test true = \"$rebase\" && {\n \t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n \tfi\n \toldremoteref= &&\n+\ttest -n \"$curr_branch\" &&\n \t. git-parse-remote &&\n \tremoteref=\"$(get_remote_merge_branch \"$@\" 2>/dev/null)\" &&\n \toldremoteref=\"$(git rev-parse -q --verify \"$remoteref\")\" &&\n-- \n1.8.0.2.gc921d59.dirty\n"},{"id":"201877","messageId":"20121025093441.GH8390@sigill.intra.peff.net","threadId":"31923","inReplyTo":"1351024796-28174-2-git-send-email-hordp@cisco.com","subject":"Re: [PATCHv2] git-pull: Avoid merge-base on detached head","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-25T09:34:41Z","receivedAt":"2012-10-25T09:34:41Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Oct 23, 2012 at 04:39:56PM -0400, Phil Hord wrote:\n\n> git pull --rebase does some clever tricks to find the base\n> for $upstream , but it forgets that we may not have any\n> branch at all.  When this happens, git merge-base reports its\n> \"usage\" help in the middle of an otherwise successful\n> rebase operation, because git-merge is called with one too\n> few parameters.\n> \n> Since we do not need the merge-base trick in the case of a\n> detached HEAD, detect this condition and bypass the clever\n> trick and the usage noise.\n\nMakes sense. I notice there is no test with your patch. It sounds from\nthe description like the operation still may succeed, but we just get\ncruft on stderr?\n\n-Peff\n"},{"id":"201916","messageId":"508989FD.7090101@cisco.com","threadId":"31923","inReplyTo":"20121025093441.GH8390@sigill.intra.peff.net","subject":"Re: [PATCHv2] git-pull: Avoid merge-base on detached head","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-25T18:50:37Z","receivedAt":"2012-10-25T18:50:37Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"Jeff King wrote:\n> On Tue, Oct 23, 2012 at 04:39:56PM -0400, Phil Hord wrote:\n>\n>> git pull --rebase does some clever tricks to find the base\n>> for $upstream , but it forgets that we may not have any\n>> branch at all.  When this happens, git merge-base reports its\n>> \"usage\" help in the middle of an otherwise successful\n>> rebase operation, because git-merge is called with one too\n>> few parameters.\n>>\n>> Since we do not need the merge-base trick in the case of a\n>> detached HEAD, detect this condition and bypass the clever\n>> trick and the usage noise.\n> Makes sense. I notice there is no test with your patch. It sounds from\n> the description like the operation still may succeed, but we just get\n> cruft on stderr?\n>\n\nYes, that's correct.\n\nP\n"},{"id":"201938","messageId":"20121026124810.GC1455@sigill.intra.peff.net","threadId":"31923","inReplyTo":"508989FD.7090101@cisco.com","subject":"Re: [PATCHv2] git-pull: Avoid merge-base on detached head","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-26T12:48:10Z","receivedAt":"2012-10-26T12:48:10Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 25, 2012 at 02:50:37PM -0400, Phil Hord wrote:\n\n> >> git pull --rebase does some clever tricks to find the base\n> >> for $upstream , but it forgets that we may not have any\n> >> branch at all.  When this happens, git merge-base reports its\n> >> \"usage\" help in the middle of an otherwise successful\n> >> rebase operation, because git-merge is called with one too\n> >> few parameters.\n> >>\n> >> Since we do not need the merge-base trick in the case of a\n> >> detached HEAD, detect this condition and bypass the clever\n> >> trick and the usage noise.\n> > Makes sense. I notice there is no test with your patch. It sounds from\n> > the description like the operation still may succeed, but we just get\n> > cruft on stderr?\n> >\n> \n> Yes, that's correct.\n\nOK. I'd rather not worry about a test then, as it would necessarily be\nflaky with respect to what git-pull might generate on its stderr. I've\nqueued your patch in 'next'.\n\nThanks.\n\n-Peff\n"}]}