{"thread":{"id":"25941","subject":"BUG: git pull --rebase on detatched head prints a lot of usage warnings","startedAt":"2010-12-03T18:38:54Z","lastAt":"2010-12-03T22:31:57Z","messageCount":8,"participants":["Sverre Rabbelier","Jonathan Nieder","Santi Béjar","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"157232","messageId":"AANLkTimyCG6zVhc4znWPWwipd0bn-YT2FrOT=T0AgHNW@mail.gmail.com","threadId":"25941","inReplyTo":null,"subject":"BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-12-03T18:38:54Z","receivedAt":"2010-12-03T18:38:54Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nsverre@laptop-sverre:~/code/Melange\n$ git pull --rebase\nusage: git merge-base [-a|--all] [--octopus] <commit> <commit>...\n   or: git merge-base --independent <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\nusage: git merge-base [-a|--all] [--octopus] <commit> <commit>...\n   or: git merge-base --independent <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\nusage: git merge-base [-a|--all] [--octopus] <commit> <commit>...\n   or: git merge-base --independent <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\n\n[... many more snipped ...]\n\nYou are not currently on a branch, so I cannot use any\n'branch.<branchname>.merge' in your configuration file.\nPlease specify which remote branch you want to use on the command\nline and try again (e.g. 'git pull <repository> <refspec>').\nSee git-pull(1) for details.\n\n\nThere are 127 helpful messages in total.\n\nOutput with GIT_TRACE set:\n\ntrace: exec: 'git-pull' '--rebase'\ntrace: run_command: 'git-pull' '--rebase'\ntrace: built-in: git 'rev-parse' '--git-dir'\ntrace: built-in: git 'rev-parse' '--is-inside-work-tree'\ntrace: built-in: git 'rev-parse' '--show-toplevel'\ntrace: built-in: git 'ls-files' '-u'\ntrace: built-in: git 'symbolic-ref' '-q' 'HEAD'\ntrace: built-in: git 'config' '--bool' 'branch..rebase'\ntrace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'\ntrace: built-in: git 'rev-parse' '--verify' 'HEAD'\ntrace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'\ntrace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'\ntrace: built-in: git 'diff-index' '--cached' '--quiet'\n'--ignore-submodules' 'HEAD' '--'\ntrace: built-in: git 'rev-parse' '-q' '--git-dir'\ntrace: built-in: git 'symbolic-ref' '-q' 'HEAD'\ntrace: built-in: git 'config' '--get' 'branch..remote'\ntrace: built-in: git 'symbolic-ref' '-q' 'HEAD'\ntrace: built-in: git 'for-each-ref' '--format=%(upstream)'\ntrace: built-in: git 'rev-parse' '-q' '--verify' 'refs/remotes/origin/tip'\ntrace: built-in: git 'rev-list' '-g' 'refs/remotes/origin/tip'\ntrace: built-in: git 'merge-base' '927b640697cf707a8d3d26b39c926be052c3aa7c'\ntrace: built-in: git 'merge-base' '8281385d7b5132a51ae1f3ad515f0220478c7f40'\n\nTested on current next.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"157235","messageId":"20101203190050.GB14049@burratino","threadId":"25941","inReplyTo":"AANLkTimyCG6zVhc4znWPWwipd0bn-YT2FrOT=T0AgHNW@mail.gmail.com","subject":"Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-03T19:00:50Z","receivedAt":"2010-12-03T19:00:50Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n\n> $ git pull --rebase\n> usage: git merge-base [-a|--all] [--octopus] <commit> <commit>...\n[...]\n> [... many more snipped ...]\n>\n> You are not currently on a branch, so I cannot use any\n> 'branch.<branchname>.merge' in your configuration file.\n> Please specify which remote branch you want to use on the command\n> line and try again (e.g. 'git pull <repository> <refspec>').\n> See git-pull(1) for details.\n>\n>\n> There are 127 helpful messages in total.\n\nDoes the following take care of it?\n\ncc-ing Santi, author of the very nice v1.6.4.1~6^2 (pull: support\nrebased upstream + fetch + pull --rebase, 2009-07-19).  Maybe we\nshould make merge-base more tolerant.\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 8eb74d4..bbc369d 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -212,7 +212,7 @@ test true = \"$rebase\" && {\n \toldremoteref=\"$(git rev-parse -q --verify \"$remoteref\")\" &&\n \tfor reflog in $(git rev-list -g $remoteref 2>/dev/null)\n \tdo\n-\t\tif test \"$reflog\" = \"$(git merge-base $reflog $curr_branch)\"\n+\t\tif test \"$reflog\" = \"$(git show-branch --merge-base $reflog $curr_branch)\"\n \t\tthen\n \t\t\toldremoteref=\"$reflog\"\n \t\t\tbreak\n"},{"id":"157238","messageId":"AANLkTin-9pb7cxsAvDqWj3So47_zq5co9TZRWux9ezxz@mail.gmail.com","threadId":"25941","inReplyTo":"20101203190050.GB14049@burratino","subject":"Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-12-03T19:05:33Z","receivedAt":"2010-12-03T19:05:33Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Dec 3, 2010 at 20:00, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Does the following take care of it?\n\nYes.\n\nTested-by: Sverre Rabbelier <srabbelier@gmail.com>\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"157253","messageId":"AANLkTikwdqQpmyxZu-kp7UHjYnKuVxs8urxM=9c=66H0@mail.gmail.com","threadId":"25941","inReplyTo":"AANLkTin-9pb7cxsAvDqWj3So47_zq5co9TZRWux9ezxz@mail.gmail.com","subject":"Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2010-12-03T20:23:54Z","receivedAt":"2010-12-03T20:23:54Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Dec 3, 2010 at 8:05 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> Heya,\n>\n> On Fri, Dec 3, 2010 at 20:00, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>> Does the following take care of it?\n>\n> Yes.\n\nI also think it fixes, but I wonder if it's the best fix. One thing is\nthat show-branch is an ancillary command, and not a plumbing command\n(but there is already a call to show-branch, but it should probably be\nchange to merge-base now that it handles three commit as arguments).\n\nThe problem is that many parts of git-pull.sh/git-parse-remote.sh\nassume that you are not in a detached HEAD. Can you confirm that the\nfollowing patch fixes it?\n\ndiff --git i/git-parse-remote.sh w/git-parse-remote.sh\nindex 5f47b18..6d0a5de 100644\n--- i/git-parse-remote.sh\n+++ w/git-parse-remote.sh\n@@ -68,7 +68,7 @@ get_remote_merge_branch () {\n            test -z \"$origin\" && origin=$default\n            curr_branch=$(git symbolic-ref -q HEAD)\n            [ \"$origin\" = \"$default\" ] &&\n-           echo $(git for-each-ref --format='%(upstream)' $curr_branch)\n+           echo $(git for-each-ref --format='%(upstream)' HEAD)\n            ;;\n        *)\n            repo=$1\n\nI'm wondering if most of $curr_branch should be changed to HEAD, I'll check it.\n\nHTH,\nSanti\n"},{"id":"157257","messageId":"AANLkTikNLqBo+5JnVSRhpdC9qWJHggmo02-xDCxmmZKG@mail.gmail.com","threadId":"25941","inReplyTo":"AANLkTikwdqQpmyxZu-kp7UHjYnKuVxs8urxM=9c=66H0@mail.gmail.com","subject":"Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-12-03T20:45:25Z","receivedAt":"2010-12-03T20:45:25Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Dec 3, 2010 at 21:23, Santi Béjar <santi@agolina.net> wrote:\n> The problem is that many parts of git-pull.sh/git-parse-remote.sh\n> assume that you are not in a detached HEAD. Can you confirm that the\n> following patch fixes it?\n\nYes.\n\nTested-by: Sverre Rabbelier <srabbelier@gmail.com>\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"157264","messageId":"7vbp52o9c6.fsf@alter.siamese.dyndns.org","threadId":"25941","inReplyTo":"AANLkTikwdqQpmyxZu-kp7UHjYnKuVxs8urxM=9c=66H0@mail.gmail.com","subject":"Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-03T21:06:01Z","receivedAt":"2010-12-03T21:06:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <santi@agolina.net> writes:\n\n> I also think it fixes, but I wonder if it's the best fix. One thing is\n> that show-branch is an ancillary command, and not a plumbing command\n> (but there is already a call to show-branch, but it should probably be\n> change to merge-base now that it handles three commit as arguments).\n\nAre you sure \"show-branch --merge-base A B C\" and \"merge-base A B C\" are\nmeant to compute the same thing?\n\nI do not think ancillary necessarily means Porcelain, but that is a\nseparate issue.\n"},{"id":"157277","messageId":"AANLkTimgk-jqyKD+ab=bHZLVH3F52WqCjr4v3chMY_Fv@mail.gmail.com","threadId":"25941","inReplyTo":"7vbp52o9c6.fsf@alter.siamese.dyndns.org","subject":"Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2010-12-03T22:16:11Z","receivedAt":"2010-12-03T22:16:11Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Dec 3, 2010 at 10:06 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Santi Béjar <santi@agolina.net> writes:\n>\n>> I also think it fixes, but I wonder if it's the best fix. One thing is\n>> that show-branch is an ancillary command, and not a plumbing command\n>> (but there is already a call to show-branch, but it should probably be\n>> change to merge-base now that it handles three commit as arguments).\n>\n> Are you sure \"show-branch --merge-base A B C\" and \"merge-base A B C\" are\n> meant to compute the same thing?\n\nNo, I'm not sure. In fact the documentation explicit says that they\nare different. But I fail to see when it matters, and more\nspecifically (now that I've reread the docs), what is the point of\n\"merge-base A B C\".\n\nJust a data point, show-branch --merge-base is only used once in the\ncode, in git-pull.sh, but \"git merge-base A B C\" is not used (at least\nusing my grep).\n\nOr the equivalent is the undocumented \"git merge-base --octopus A B C\"?\n\n>\n> I do not think ancillary necessarily means Porcelain, but that is a\n> separate issue.\n\nMe neither. But is the promise to not change the behavior/output as\nhard as with plumbing?\n\nSanti\n"},{"id":"157281","messageId":"7vy686lc82.fsf@alter.siamese.dyndns.org","threadId":"25941","inReplyTo":"AANLkTimgk-jqyKD+ab=bHZLVH3F52WqCjr4v3chMY_Fv@mail.gmail.com","subject":"Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-03T22:31:57Z","receivedAt":"2010-12-03T22:31:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <santi@agolina.net> writes:\n\n> No, I'm not sure. In fact the documentation explicit says that they\n> are different. But I fail to see when it matters, and more\n> specifically (now that I've reread the docs), what is the point of\n> \"merge-base A B C\".\n\nSee c5dc9a2 (git-merge-octopus: use (merge-base A (merge B C D E...)) for\nstepwise merge, 2008-07-27), not the patch but the explanation.\n\n> Just a data point, show-branch --merge-base is only used once in the\n> code, in git-pull.sh, but \"git merge-base A B C\" is not used (at least\n> using my grep).\n\nYour grep skill needs honing ;-)  The variable MRC in git-merge-octopus is\na space separated list of commit object names, split at $IFS when\nmerge-base is called.\n"}]}