{"thread":{"id":"32606","subject":"How to setup bash completion for alias of git command","startedAt":"2013-01-12T14:30:45Z","lastAt":"2013-01-21T03:55:27Z","messageCount":4,"participants":["Ping Yin","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"206598","messageId":"CACSwcnQu8Rx83mcGYR6NGzEhoreNR6DfiK876LF7pa9PGm30JA@mail.gmail.com","threadId":"32606","inReplyTo":null,"subject":"How to setup bash completion for alias of git command","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2013-01-12T14:30:45Z","receivedAt":"2013-01-12T14:30:45Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"Following setup works for me  in ubuntu (10.04,11.04) for a long time\n\nalias gtlg='git log'\ncomplete -o default -o nospace -F _git_log gtlg\n\nHowever, in debian (testing, wheezy), it doesn't work\n\n$ gtlg or<TAB>\ngtlg or-bash: [: 1: unary operator expected\n-bash: [: 1: unary operator expected\n\n$ git --version\ngit version 1.7.10\n\nCan anybody help?\n"},{"id":"206641","messageId":"CACSwcnRs3vxm0L4XrD0mUvgmQfz=qQH1yT7fX9kBwODiWcuxzQ@mail.gmail.com","threadId":"32606","inReplyTo":"CACSwcnQu8Rx83mcGYR6NGzEhoreNR6DfiK876LF7pa9PGm30JA@mail.gmail.com","subject":"Re: How to setup bash completion for alias of git command","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2013-01-13T03:13:18Z","receivedAt":"2013-01-13T03:13:18Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sat, Jan 12, 2013 at 10:30 PM, Ping Yin <pkufranky@gmail.com> wrote:\n> Following setup works for me  in ubuntu (10.04,11.04) for a long time\n>\n> alias gtlg='git log'\n> complete -o default -o nospace -F _git_log gtlg\n>\n> However, in debian (testing, wheezy), it doesn't work\n>\n> $ gtlg or<TAB>\n> gtlg or-bash: [: 1: unary operator expected\n> -bash: [: 1: unary operator expected\n>\n\nwith newest git version built with next branch, the same problem remains.\n\nPing Yin\n"},{"id":"207289","messageId":"20130120111424.GG16339@elie.Belkin","threadId":"32606","inReplyTo":"CACSwcnQu8Rx83mcGYR6NGzEhoreNR6DfiK876LF7pa9PGm30JA@mail.gmail.com","subject":"Re: How to setup bash completion for alias of git command","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-01-20T11:14:24Z","receivedAt":"2013-01-20T11:14:24Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Ping,\n\nPing Yin wrote:\n\n> Following setup works for me  in ubuntu (10.04,11.04) for a long time\n>\n> alias gtlg='git log'\n> complete -o default -o nospace -F _git_log gtlg\n>\n> However, in debian (testing, wheezy), it doesn't work\n>\n> $ gtlg or<TAB>\n> gtlg or-bash: [: 1: unary operator expected\n> -bash: [: 1: unary operator expected\n\nYes, I can reproduce this.  \"git bisect\" tells me it was introduced\nby v1.7.6-rc0~65^2~4 (completion: remove unnecessary\n_get_comp_words_by_ref() invocations, 2011-04-28).  Since then, Felipe\nhas done work to make reusing subcommand completion easy again, so you\ncan do\n\n\t__git_complete gtlg _git_log\n\nOne complication: on some systems, including Ubuntu 13.04, git's bash\ncompletion script is installed to\n\n\t/usr/share/bash-completion/completions/git\n\nand sourced on the fly when completing commands starting with \"git\"\ninstead of right away from /etc/bash_completion.  On these systems,\nthe \"__git_complete\" function would not be usable right away from\nyour .bashrc file.  I think we should fix this, for example by moving\nthe function to a separate\n\n\t$(git --exec-path)/git-bashrc-functions\n\nlibrary.\n\nThanks for reporting,\nJonathan\n"},{"id":"207363","messageId":"CACSwcnQu0qgKPhDXeDTFTZgh7FBVmaTCTkoJmEsCTUtaM9HU6g@mail.gmail.com","threadId":"32606","inReplyTo":"20130120111424.GG16339@elie.Belkin","subject":"Re: How to setup bash completion for alias of git command","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2013-01-21T03:55:27Z","receivedAt":"2013-01-21T03:55:27Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Sun, Jan 20, 2013 at 7:14 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Hi Ping,\n>\n> Ping Yin wrote:\n>>\n>> However, in debian (testing, wheezy), it doesn't work\n>>\n>> $ gtlg or<TAB>\n>> gtlg or-bash: [: 1: unary operator expected\n>> -bash: [: 1: unary operator expected\n>\n> Yes, I can reproduce this.  \"git bisect\" tells me it was introduced\n> by v1.7.6-rc0~65^2~4 (completion: remove unnecessary\n> _get_comp_words_by_ref() invocations, 2011-04-28).  Since then, Felipe\n> has done work to make reusing subcommand completion easy again, so you\n> can do\n>\n>         __git_complete gtlg _git_log\n>\n\nThanks very much. by following your advice, it works now.\n\nPing Yin\n"}]}