Re: How to setup bash completion for alias of git command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ping,

Ping Yin wrote:

> Following setup works for me  in ubuntu (10.04,11.04) for a long time
>
> alias gtlg='git log'
> complete -o default -o nospace -F _git_log gtlg
>
> However, in debian (testing, wheezy), it doesn't work
>
> $ gtlg or<TAB>
> gtlg or-bash: [: 1: unary operator expected
> -bash: [: 1: unary operator expected

Yes, I can reproduce this.  "git bisect" tells me it was introduced
by v1.7.6-rc0~65^2~4 (completion: remove unnecessary
_get_comp_words_by_ref() invocations, 2011-04-28).  Since then, Felipe
has done work to make reusing subcommand completion easy again, so you
can do

	__git_complete gtlg _git_log

One complication: on some systems, including Ubuntu 13.04, git's bash
completion script is installed to

	/usr/share/bash-completion/completions/git

and sourced on the fly when completing commands starting with "git"
instead of right away from /etc/bash_completion.  On these systems,
the "__git_complete" function would not be usable right away from
your .bashrc file.  I think we should fix this, for example by moving
the function to a separate

	$(git --exec-path)/git-bashrc-functions

library.

Thanks for reporting,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]