{"thread":{"id":"30554","subject":"git-completion with bash alias","startedAt":"2012-05-18T11:35:24Z","lastAt":"2012-05-19T07:50:59Z","messageCount":5,"participants":["Carsten Mattner","Jeff King","Felipe Contreras"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191655","messageId":"CACY+Hvqd6L7gWgDBvjPmLPsfA2o1CVKuqkDZ_j7XYf=WjuwvKQ@mail.gmail.com","threadId":"30554","inReplyTo":null,"subject":"git-completion with bash alias","fromName":"Carsten Mattner","fromEmail":"carstenmattner@googlemail.com","sentAt":"2012-05-18T11:35:24Z","receivedAt":"2012-05-18T11:35:24Z","isPatch":false,"sender":{"key":"carstenmattner@googlemail.com","avatar":null},"body":"Completion works when used as \"git checkout foo\" but fails with\n\"bash: [: 1: unary operator expected\" when trying to complete\nvia a single character shell alias like \"alias g=git\" as in\n\"g checkout foo\".\n\ngit version 1.7.10.2.548.g9de9681\n"},{"id":"191706","messageId":"20120519004147.GE765@sigill.intra.peff.net","threadId":"30554","inReplyTo":"CACY+Hvqd6L7gWgDBvjPmLPsfA2o1CVKuqkDZ_j7XYf=WjuwvKQ@mail.gmail.com","subject":"Re: git-completion with bash alias","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-19T00:41:47Z","receivedAt":"2012-05-19T00:41:47Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 18, 2012 at 01:35:24PM +0200, Carsten Mattner wrote:\n\n> Completion works when used as \"git checkout foo\" but fails with\n> \"bash: [: 1: unary operator expected\" when trying to complete\n> via a single character shell alias like \"alias g=git\" as in\n> \"g checkout foo\".\n> \n> git version 1.7.10.2.548.g9de9681\n\nHmm. Are you invoking the completion like:\n\n  complete -F _git g\n\n? That used to work, but was broken by the recent 6b179ad (completion:\nadd new __git_complete helper, 2012-05-14).\n\nThe \"new\" way seems to be:\n\n  __git_complete g _git\n\nbut that function is explicitly labeled as \"not public\". It looks like\nthere was a follow-on patch that was discussed to make a public version,\nbut it got dropped.\n\nI'm not sure if this regression is intentional, or if the \"old\" way even\nworked reliably (I seem to recall people running into issues with\n_get_comp_words_by_ref not being called properly sometimes, but I don't\nremember the details). So it's not clear to me if the right way forward\nis fixing \"complete -F _git\" to work again, or if that way is just\nbroken, and a public version of __git_complete is the right path.\n\nFelipe, can you comment?\n\n-Peff\n"},{"id":"191710","messageId":"CAMP44s3DzJFoXTbUKEKUKcSs1TRWGW+2Ze+zMA1ch2eVgtu9bA@mail.gmail.com","threadId":"30554","inReplyTo":"20120519004147.GE765@sigill.intra.peff.net","subject":"Re: git-completion with bash alias","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2012-05-19T02:28:53Z","receivedAt":"2012-05-19T02:28:53Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sat, May 19, 2012 at 2:41 AM, Jeff King <peff@peff.net> wrote:\n> On Fri, May 18, 2012 at 01:35:24PM +0200, Carsten Mattner wrote:\n>\n>> Completion works when used as \"git checkout foo\" but fails with\n>> \"bash: [: 1: unary operator expected\" when trying to complete\n>> via a single character shell alias like \"alias g=git\" as in\n>> \"g checkout foo\".\n>>\n>> git version 1.7.10.2.548.g9de9681\n>\n> Hmm. Are you invoking the completion like:\n>\n>  complete -F _git g\n\ns/_git/__git_wrap_git/\n\n> ? That used to work, but was broken by the recent 6b179ad (completion:\n> add new __git_complete helper, 2012-05-14).\n>\n> The \"new\" way seems to be:\n>\n>  __git_complete g _git\n>\n> but that function is explicitly labeled as \"not public\". It looks like\n> there was a follow-on patch that was discussed to make a public version,\n> but it got dropped.\n\nWell, _git was probably not public either.\n\n> I'm not sure if this regression is intentional, or if the \"old\" way even\n> worked reliably (I seem to recall people running into issues with\n> _get_comp_words_by_ref not being called properly sometimes, but I don't\n> remember the details). So it's not clear to me if the right way forward\n> is fixing \"complete -F _git\" to work again, or if that way is just\n> broken, and a public version of __git_complete is the right path.\n>\n> Felipe, can you comment?\n\nThe problem is with certain functions (e.g. _git_fetch), which are\nbroken not only for aliases: try 'git --git-dir=$PWD fetch <tab>'.\n\nShould be easy to provide backward compatibility though.\n\nI'll send a patch soon.\n\n-- \nFelipe Contreras\n"},{"id":"191728","messageId":"CACY+Hvr79p4c1Caw=vrJ0293tz3Hub+RK4XuL1Ue-JAmt8Odxw@mail.gmail.com","threadId":"30554","inReplyTo":"20120519004147.GE765@sigill.intra.peff.net","subject":"Re: git-completion with bash alias","fromName":"Carsten Mattner","fromEmail":"carstenmattner@googlemail.com","sentAt":"2012-05-19T07:48:47Z","receivedAt":"2012-05-19T07:48:47Z","isPatch":false,"sender":{"key":"carstenmattner@googlemail.com","avatar":null},"body":"On Sat, May 19, 2012 at 2:41 AM, Jeff King <peff@peff.net> wrote:\n> On Fri, May 18, 2012 at 01:35:24PM +0200, Carsten Mattner wrote:\n>\n>> Completion works when used as \"git checkout foo\" but fails with\n>> \"bash: [: 1: unary operator expected\" when trying to complete\n>> via a single character shell alias like \"alias g=git\" as in\n>> \"g checkout foo\".\n>>\n>> git version 1.7.10.2.548.g9de9681\n>\n> Hmm. Are you invoking the completion like:\n>\n>  complete -F _git g\n\nIs that supposed to be enough to get it working?\n\n> ? That used to work, but was broken by the recent 6b179ad (completion:\n> add new __git_complete helper, 2012-05-14).\n>\n> The \"new\" way seems to be:\n>\n>  __git_complete g _git\n\nFound that in 6b179adf in next and it worked.\nI used to have this\ncomplete -o bashdefault -o default -o nospace -F _git g \\\n  2>/dev/null || complete -o default -o nospace -F _git g\n\n> but that function is explicitly labeled as \"not public\". It looks like\n> there was a follow-on patch that was discussed to make a public version,\n> but it got dropped.\n>\n> I'm not sure if this regression is intentional, or if the \"old\" way even\n> worked reliably (I seem to recall people running into issues with\n> _get_comp_words_by_ref not being called properly sometimes, but I don't\n> remember the details). So it's not clear to me if the right way forward\n> is fixing \"complete -F _git\" to work again, or if that way is just\n> broken, and a public version of __git_complete is the right path.\n>\n> Felipe, can you comment?\n>\n> -Peff\n"},{"id":"191729","messageId":"CACY+HvryQvZedBhYjeG3O2GvvrqipvZFm3kW5mcm70mdrFjVLg@mail.gmail.com","threadId":"30554","inReplyTo":"CAMP44s3DzJFoXTbUKEKUKcSs1TRWGW+2Ze+zMA1ch2eVgtu9bA@mail.gmail.com","subject":"Re: git-completion with bash alias","fromName":"Carsten Mattner","fromEmail":"carstenmattner@googlemail.com","sentAt":"2012-05-19T07:50:59Z","receivedAt":"2012-05-19T07:50:59Z","isPatch":false,"sender":{"key":"carstenmattner@googlemail.com","avatar":null},"body":"On Sat, May 19, 2012 at 4:28 AM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> On Sat, May 19, 2012 at 2:41 AM, Jeff King <peff@peff.net> wrote:\n>> On Fri, May 18, 2012 at 01:35:24PM +0200, Carsten Mattner wrote:\n>>\n>>> Completion works when used as \"git checkout foo\" but fails with\n>>> \"bash: [: 1: unary operator expected\" when trying to complete\n>>> via a single character shell alias like \"alias g=git\" as in\n>>> \"g checkout foo\".\n>>>\n>>> git version 1.7.10.2.548.g9de9681\n>>\n>> Hmm. Are you invoking the completion like:\n>>\n>>  complete -F _git g\n>\n> s/_git/__git_wrap_git/\n>\n>> ? That used to work, but was broken by the recent 6b179ad (completion:\n>> add new __git_complete helper, 2012-05-14).\n>>\n>> The \"new\" way seems to be:\n>>\n>>  __git_complete g _git\n>>\n>> but that function is explicitly labeled as \"not public\". It looks like\n>> there was a follow-on patch that was discussed to make a public version,\n>> but it got dropped.\n>\n> Well, _git was probably not public either.\n>\n>> I'm not sure if this regression is intentional, or if the \"old\" way even\n>> worked reliably (I seem to recall people running into issues with\n>> _get_comp_words_by_ref not being called properly sometimes, but I don't\n>> remember the details). So it's not clear to me if the right way forward\n>> is fixing \"complete -F _git\" to work again, or if that way is just\n>> broken, and a public version of __git_complete is the right path.\n>>\n>> Felipe, can you comment?\n>\n> The problem is with certain functions (e.g. _git_fetch), which are\n> broken not only for aliases: try 'git --git-dir=$PWD fetch <tab>'.\n>\n> Should be easy to provide backward compatibility though.\n>\n> I'll send a patch soon.\n\nAny advice what I should put after alias g=git to enable\ncompletion for g? Temporarily using \"__git_complete g _git\".\n"}]}