threads / discuss / 10443

UI and git-completion.sh

Subject: UI and git-completion.sh

## tl;dr

13 messages between Oct 23, 2007 and Oct 24, 2007.

replies: 12people: 8as markdown or json

Paolo Ciarrocchi· Oct 23, 2007, 21:46 UTC · lore
Hi all,
I just asked for help on the #git irc channel in order to install
the .git-completion.sh script (thanks nessundorma) and after using it 
for a while I started wondering why I cannot find any reference to it the 
official documentation.
The only important think that git grep found is:
	paolo@paolo-desktop:~/git$ git grep completion *
	Documentation/RelNotes-1.5.0.txt: - Bash completion scripts have been updated heavily.
Shouldn't it be mentioned somewhere? 
I know that newbies are somehow scared by the following:
	paolo@paolo-desktop:~/git$ git-
	Display all 151 possibilities? (y or n)
What? Do I have to learn 151 commands?
No way!
Using the git-completation script it all boils down to 48 commands.

paolo@paolo-desktop:~/git$ git add fetch rebase am filter-branch rebase--interactive annotate format-patch relink apply fsck remote archive gc repack bisect get-tar-commit-id request-pull blame grep reset branch gui resolve bundle imap-send revert checkout init rm checkout-index instaweb send-email cherry log shortlog cherry-pick lost-found show citool ls-files show-branch clean ls-remote show-ref clone ls-tree stash commit merge status config mergetool submodule convert-objects mv tag count-objects name-rev var describe pickaxe verify-pack diff pull whatchanged diff-stages push

And I think I can remove some commands from the list.

What people think about starting suggesting the usage of the script in the documentation? I just want to know the opinion of the list before trying to write a documentation patch. Next step would be to reduce the number of the items listed by git <tab> but I know there is already a discussion about it on the list.

Regards,
		Paolo
Steven Grimm· Oct 23, 2007, 22:00 UTC · re: Paolo Ciarrocchi · lore

Re: UI and git-completion.sh

Paolo Ciarrocchi wrote:
> What people think about starting suggesting the usage of the script in the documentation?
>   

Also might be worth mentioning the zsh completion support. (I know it's there, but haven't used it -- maybe its author would care to describe it a bit?)

-Steve
Randal L. Schwartz· Oct 23, 2007, 23:44 UTC · re: Steven Grimm · lore

Re: UI and git-completion.sh

>>>>> "Steven" == Steven Grimm <koreth@midwinter.com> writes:

Steven> Also might be worth mentioning the zsh completion support. (I know it's there, Steven> but haven't used it -- maybe its author would care to describe it a bit?)

Where is it?  I'm a zsh user, and would love to have git support.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Matthieu Moy· Oct 23, 2007, 23:54 UTC · re: Randal L. Schwartz · lore

Re: UI and git-completion.sh

merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 6 quoted lines
>>>>>> "Steven" == Steven Grimm <koreth@midwinter.com> writes:
>
> Steven> Also might be worth mentioning the zsh completion support. (I know it's there,
> Steven> but haven't used it -- maybe its author would care to describe it a bit?)
>
> Where is it?  I'm a zsh user, and would love to have git support.
In zsh itself.
Completion/Unix/Command/_git
-- 
Matthieu
Randal L. Schwartz· Oct 24, 2007, 00:01 UTC · re: Matthieu Moy · lore

Re: UI and git-completion.sh

>>>>> "Matthieu" == Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Matthieu> In zsh itself.
Matthieu> Completion/Unix/Command/_git
Not in my version of zsh.  Any chance I can add that to my 4.2.3 installation?
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Matthieu Moy· Oct 24, 2007, 00:46 UTC · re: Randal L. Schwartz · lore

Re: UI and git-completion.sh

merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 8 quoted lines
>>>>>> "Matthieu" == Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
> Matthieu> In zsh itself.
>
> Matthieu> Completion/Unix/Command/_git
>
> Not in my version of zsh.  Any chance I can add that to my 4.2.3
> installation?
http://zsh.cvs.sourceforge.net/zsh/zsh/Completion/Unix/Command/_git

Try adding it to your $fpath, hopefully, the new _git doesn't use the other new zsh features, and it will work (I have a CVS _git with a 4.3.4 zsh, and it works like a charm).

-- 
Matthieu
Randal L. Schwartz· Oct 24, 2007, 00:50 UTC · re: Matthieu Moy · lore

Re: UI and git-completion.sh

>>>>> "Matthieu" == Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Matthieu> http://zsh.cvs.sourceforge.net/zsh/zsh/Completion/Unix/Command/_git

Matthieu> Try adding it to your $fpath, hopefully, the new _git doesn't use the Matthieu> other new zsh features, and it will work (I have a CVS _git with a Matthieu> 4.3.4 zsh, and it works like a charm).

Do I add it as _git below my $fpath? Or do I need to put it into a subdir? How will it know it is there?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Johannes Gilger· Oct 24, 2007, 17:34 UTC · re: Randal L. Schwartz · lore

Re: UI and git-completion.sh

Randal L. Schwartz wrote:
> Where is it?  I'm a zsh user, and would love to have git support.
> 

Another way to get git-completion support with zsh (works with 4.3.2) is to use the existing bash-completion and enable bash-completion for zsh via: autoload bashcompinit bashcompinit in your .zshrc or similar. Btw, if you use gentoo you can install git with bash-completion, although i suppose that most people here are not using emerge to get their git ;).

Greetings, Johannes

-- 
Johannes Gilger <heipei@hackvalue.de>
http://hackvalue.de/heipei/
GPG-Key: 0x42F6DE81
GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81
Johannes Schindelin· Oct 24, 2007, 10:20 UTC · re: Paolo Ciarrocchi · lore

Re: UI and git-completion.sh

Hi,
On Tue, 23 Oct 2007, Paolo Ciarrocchi wrote:
Show 26 quoted lines
> Using the git-completation script it all boils down to 48 commands.
> 
> paolo@paolo-desktop:~/git$ git 
> add                   fetch                 rebase 
> am                    filter-branch         rebase--interactive 
> annotate              format-patch          relink 
> apply                 fsck                  remote 
> archive               gc                    repack 
> bisect                get-tar-commit-id     request-pull 
> blame                 grep                  reset 
> branch                gui                   resolve 
> bundle                imap-send             revert 
> checkout              init                  rm 
> checkout-index        instaweb              send-email 
> cherry                log                   shortlog 
> cherry-pick           lost-found            show 
> citool                ls-files              show-branch 
> clean                 ls-remote             show-ref 
> clone                 ls-tree               stash 
> commit                merge                 status 
> config                mergetool             submodule 
> convert-objects       mv                    tag 
> count-objects         name-rev              var 
> describe              pickaxe               verify-pack 
> diff                  pull                  whatchanged 
> diff-stages           push

diff-stages just struck my eye. It is no longer in git... But AFAICS it is no longer in git-completion.bash either.

Besides, I think that the number of commands could be reduced further. For example, I think that a regular user does not want to see

checkout-index, citool, convert-objects, filter-branch, get-tar-commit-id, imap-send, instaweb, lost-found, ls-tree, name-rev, rebase--interactive, relink, repack, request-pull, show-ref, var, verify-pack and whatchanged.

This list was not vs the quoted list, but my current list (pretty much tip of Shawn's "next".

Note: I would like to complete the _options_ when one of these subcommands 
was specified, but I just do not want to see them when entering 
"git<SPACE><TAB>".

BTW Pierre's idea of generating many (if not all) of these completions on the fly (maybe with "--help-completion"?) is intriguing.

Ciao, Dscho

Pierre Habouzit· Oct 24, 2007, 17:07 UTC · re: Johannes Schindelin · lore

Re: UI and git-completion.sh

On Wed, Oct 24, 2007 at 10:20:07AM +0000, Johannes Schindelin wrote:
> BTW Pierre's idea of generating many (if not all) of these completions on 
> the fly (maybe with "--help-completion"?) is intriguing.
  To be fair, it's not my idea, I'm just bought to it.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Randal L. Schwartz· Oct 24, 2007, 00:31 UTC · lore

Re: UI and git-completion.sh

>>>>> "Steven" == Steven Grimm <koreth@midwinter.com> writes:

Steven> And I think we've just proven that more documentation is required Steven> here! (I have no idea how to enable it myself; I just know I've seen Steven> it mentioned on the list from time to time.)

Yes, so what is the process of adding the git zsh completion to any relatively stable version of zsh? Someone here must know.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Brian Downing· Oct 24, 2007, 00:55 UTC · re: Randal L. Schwartz · lore

Re: UI and git-completion.sh

On Tue, Oct 23, 2007 at 05:31:02PM -0700, Randal L. Schwartz wrote:
> Yes, so what is the process of adding the git zsh completion to any
> relatively stable version of zsh?  Someone here must know.

I dunno the "right" way to do it, but I had this in my .zshrc file that I presumably cargo-culted from somewhere:

    fpath=( $HOME/.zsh/compfuncs $fpath )
So in addition to that, doing:
    wget -O ~/.zsh/compfuncs/_git 'http://zsh.cvs.sourceforge.net/*checkout*/zsh/zsh/Completion/Unix/Command/_git'

might get you something. I guess if your zsh is too old it might be incompatible with the completion script, though...

-bcd
Brian Downing· Oct 24, 2007, 00:57 UTC · re: Brian Downing · lore

Re: UI and git-completion.sh

On Tue, Oct 23, 2007 at 07:55:49PM -0500, Brian Downing wrote:
> I dunno the "right" way to do it, but I had this in my .zshrc file that
> I presumably cargo-culted from somewhere:
> 
>     fpath=( $HOME/.zsh/compfuncs $fpath )

I think this has to come before "compinit" or whatever starts up the new completion engine.

-bcd

← back to recent threads