{"thread":{"id":"52237","subject":"Bug in bash completion for git rebase --onto","startedAt":"2019-11-11T19:51:23Z","lastAt":"2019-11-13T01:11:51Z","messageCount":5,"participants":["Paul Jolly","Denton Liu","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"385924","messageId":"CACoUkn6D0cUmN1RbcpfERcOJsbGLdwj6oDeF2oRADV+rX2artQ@mail.gmail.com","threadId":"52237","inReplyTo":null,"subject":"Bug in bash completion for git rebase --onto","fromName":"Paul Jolly","fromEmail":"paul@myitcv.io","sentAt":"2019-11-11T19:51:08Z","receivedAt":"2019-11-11T19:51:23Z","isPatch":false,"sender":{"key":"paul@myitcv.io","avatar":"https://gravatar.com/avatar/6a83179b2ef0386af693cc03a9c50ea897f5246c5dcc0fa5d126171ba17c3a63?d=mp&s=160"},"body":"Hi,\n\nThe bash completion for git rebase --onto seems to have been broken by\ncommit 2b9bd488ae09dc89f02be7d73f3710ee2ea7325c\n\nPreviously (v2.23.0), hitting tab after\n\n    git rebase --on\n\ngives:\n\n    git rebase --onto\n\n(note trailing space) hitting tab again offers a list of potential\nrefs onto which to rebase.\n\nAs of 2b9bd488ae09dc89f02be7d73f3710ee2ea7325c, hitting tab after:\n\n    git rebase --on\n\ngives:\n\n    git rebase --onto=\n\nbut then hitting tab again offers the current directory contents as\ncandidates, i.e. not git ref candidates as they should be.\n\nNote the adding of a trailing '=' is, I think, more correct/robust\nthan the trailing space so I don't disagree with that change. It's\njust the failure to offer git ref candidates that is the problem.\n\nThanks,\n\n\nPaul\n"},{"id":"385926","messageId":"22e92546ee49d4502fd5a441741a380d62c834c7.1573507362.git.liu.denton@gmail.com","threadId":"52237","inReplyTo":"CACoUkn6D0cUmN1RbcpfERcOJsbGLdwj6oDeF2oRADV+rX2artQ@mail.gmail.com","subject":"[PATCH] completion: learn to complete `git rebase --onto=`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-11T21:25:20Z","receivedAt":"2019-11-11T21:25:26Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In 2b9bd488ae (\"completion: teach rebase to use __gitcomp_builtin\",\n2019-09-12), the completion script learned to complete rebase using\n__gitcomp_builtin(). However, this resulted in `--onto=` being suggested\ninstead of `--onto `.\n\nBefore, when there was a space, we'd start a new word and, as a result,\nfallback to __git_complete_refs() and `--onto` would be completed this\nway. However, now we match the `--*` case which does not know how to\noffer completions for refs.\n\nTeach _git_rebase() to complete refs in the `--onto=` case so that we\nfix this regression.\n\nReported-by: Paul Jolly <paul@myitcv.io>\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\nThanks for reporting the bug, Paul. I overlooked this case when I made\nthe commit that you pointed out.\n\n contrib/completion/git-completion.bash | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 7b1ab46f0b..2b644056af 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2021,6 +2021,10 @@ _git_rebase ()\n \t\t__gitcomp \"$__git_whitespacelist\" \"\" \"${cur##--whitespace=}\"\n \t\treturn\n \t\t;;\n+\t--onto=*)\n+\t\t__git_complete_refs --cur=\"${cur##--onto=}\"\n+\t\treturn\n+\t\t;;\n \t--*)\n \t\t__gitcomp_builtin rebase \"\" \\\n \t\t\t\"$__git_rebase_interactive_inprogress_options\"\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385978","messageId":"xmqqpnhxg0ra.fsf@gitster-ct.c.googlers.com","threadId":"52237","inReplyTo":"22e92546ee49d4502fd5a441741a380d62c834c7.1573507362.git.liu.denton@gmail.com","subject":"Re: [PATCH] completion: learn to complete `git rebase --onto=`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-12T04:46:33Z","receivedAt":"2019-11-12T04:46:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> Before, when there was a space, we'd start a new word and, as a result,\n> fallback to __git_complete_refs() and `--onto` would be completed this\n> way. However, now we match the `--*` case which does not know how to\n> offer completions for refs.\n\nVery well explained.  Thanks, will queue.\n"},{"id":"386027","messageId":"20191112180503.GB41101@generichostname","threadId":"52237","inReplyTo":"xmqqpnhxg0ra.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] completion: learn to complete `git rebase --onto=`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T18:05:03Z","receivedAt":"2019-11-12T18:05:07Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Junio,\n\nOn Tue, Nov 12, 2019 at 01:46:33PM +0900, Junio C Hamano wrote:\n> Denton Liu <liu.denton@gmail.com> writes:\n> \n> > Before, when there was a space, we'd start a new word and, as a result,\n> > fallback to __git_complete_refs() and `--onto` would be completed this\n> > way. However, now we match the `--*` case which does not know how to\n> > offer completions for refs.\n> \n> Very well explained.  Thanks, will queue.\n\nCould you please queue this on the tip of\n'dl/complete-rebase-and-archive' since it fixes a regression introduced\nin that branch?\n\nThanks,\n\nDenton\n"},{"id":"386077","messageId":"xmqq7e44eg18.fsf@gitster-ct.c.googlers.com","threadId":"52237","inReplyTo":"20191112180503.GB41101@generichostname","subject":"Re: [PATCH] completion: learn to complete `git rebase --onto=`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-13T01:11:47Z","receivedAt":"2019-11-13T01:11:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> On Tue, Nov 12, 2019 at 01:46:33PM +0900, Junio C Hamano wrote:\n>> Denton Liu <liu.denton@gmail.com> writes:\n>> \n>> > Before, when there was a space, we'd start a new word and, as a result,\n>> > fallback to __git_complete_refs() and `--onto` would be completed this\n>> > way. However, now we match the `--*` case which does not know how to\n>> > offer completions for refs.\n>> \n>> Very well explained.  Thanks, will queue.\n>\n> Could you please queue this on the tip of\n> 'dl/complete-rebase-and-archive' since it fixes a regression introduced\n> in that branch?\n\nThe topic dl/complete-rebase-onto, which has this patch, is built\ndirectly on top of that topic.  Since we may need to rewrite the\npatch when further review comments come in, I'd prefer to leave it\nseparate from the other topic (which must not be rewritten) at least\nfor now.\n\nThanks.\n\n"}]}