{"thread":{"id":"31798","subject":"minor bug in git pull --rebase","startedAt":"2012-10-12T22:47:47Z","lastAt":"2012-10-12T22:47:47Z","messageCount":1,"participants":["Phil Hord"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201075","messageId":"CABURp0rxUY9Tj3x3AM7avAg5FXDZXovo-9SZDF5OJ+kxB+nsnQ@mail.gmail.com","threadId":"31798","inReplyTo":null,"subject":"minor bug in git pull --rebase","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2012-10-12T22:47:47Z","receivedAt":"2012-10-12T22:47:47Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"I saw some unexpected usage output today in git pull --rebase when I\nwas on a detached head.\n\n$ git pull --rebase origin BL/3.0\nusage: git merge-base [-a|--all] <commit> <commit>...\n   or: git merge-base [-a|--all] --octopus <commit>...\n   or: git merge-base --independent <commit>...\n   or: git merge-base --is-ancestor <commit> <commit>\n\n    -a, --all             output all common ancestors\n    --octopus             find ancestors for a single n-way merge\n    --independent         list revs not reachable from others\n    --is-ancestor         is the first one ancestor of the other?\n\n>From gerrit:iptv/bootloader-all\n * branch            BL/3.0     -> FETCH_HEAD\nFirst, rewinding head to replay your work on top of it...\nFast-forwarded HEAD to 99ba23a9fce5c5becb9dd86b5f76a8467286d811.\n$\n\nIt occurs when using pull --rebase on a detached head.  It's because\ngit-pull doesn't expect ${current_branch} to be empty in some places,\nbut it does check in others.  It appears to have been introduced three\nyears ago and no one seems to have complained yet. I hesitate to\nmention it during a release cycle, but I worry I'll forget later.\n\nHere's a patch.\n\n-- >8 --\nSubject: [PATCH] git-pull: Avoid merge-base on detached head\n\ngit pull --rebase does some clever tricks to find the base\nfor $upstream , but it forgets that we may not have any\nbranch at all.  As a result, git merge-base emits some\nusage noise in the middle of an otherwise successful\nrebase operation.\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.\n---\nThere is another git-merge-base call which may need similar\ntreatment, but I have not dug deeply enough to see for sure.\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.rc2.1.g44028c0.dirty\n\nPhil\n"}]}