From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12986 invoked from network); 23 Jun 2007 10:05:21 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Jun 2007 10:05:21 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 16911 invoked from network); 23 Jun 2007 10:05:15 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Jun 2007 10:05:15 -0000 Received: (qmail 25094 invoked by alias); 23 Jun 2007 10:05:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23583 Received: (qmail 25082 invoked from network); 23 Jun 2007 10:05:05 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 23 Jun 2007 10:05:05 -0000 Received: (qmail 15901 invoked from network); 23 Jun 2007 10:05:05 -0000 Received: from mta-1.ms.rz.rwth-aachen.de (134.130.7.72) by a.mx.sunsite.dk with SMTP; 23 Jun 2007 10:05:01 -0000 Received: from ironport-out-2.rz.rwth-aachen.de ([134.130.3.59]) by mta-1.ms.rz.RWTH-Aachen.de (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTP id <0JK30055J2KBA900@mta-1.ms.rz.RWTH-Aachen.de> for zsh-workers@sunsite.dk; Sat, 23 Jun 2007 12:02:35 +0200 (CEST) Received: from relay.rwth-aachen.de ([134.130.3.1]) by ironport-in-2.rz.rwth-aachen.de with ESMTP; Sat, 23 Jun 2007 12:02:35 +0200 Received: from fsst.voodoo.lan ([212.117.84.28]) by relay.rwth-aachen.de (8.13.7/8.13.3/1) with ESMTP id l5NA2YjD011975 for ; Sat, 23 Jun 2007 12:02:34 +0200 (MEST) Received: from hawk by fsst.voodoo.lan with local (Exim 4.67) (envelope-from ) id 1I22Rm-00073x-7K for zsh-workers@sunsite.dk; Sat, 23 Jun 2007 12:02:26 +0200 Date: Sat, 23 Jun 2007 12:02:26 +0200 From: Frank Terbeck Subject: PATCH: yet another _git update To: zsh workers Mail-followup-to: zsh workers Message-id: <20070623100226.GB6305@fsst.voodoo.lan> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Content-disposition: inline X-IronPort-AV: E=Sophos;i="4.16,454,1175464800"; d="scan'208";a="2533695" User-Agent: Mutt/1.5.16 (2007-06-11) Hi list. The following patch addresses the following issues: (all related to _git_commands) a) To provide a nice looking list, we currently use a hardcoded list of 'command:description' pairs. However this does not guarantee, that all possible subcommands available on a system will be taken into account. b) git has got a nice feature, that lets you define aliases for commonly used commands, so that you can do 'git pub', which git may then (if configured) expand to 'git push public', to push local changes to a public repository for example. (Of course, you need to configure git, so that it knows where 'public' is.) These aliases are currently not considered. Both of these features are optional. To activate a), do: zstyle ':completion::*:git:*' list_allcmds true To activate b), do: zstyle ':completion::*:git:*' list_aliases true By accident, this patch also solves the 'TODO' comment above the '_git_commands' function: [snip] # TODO: either skip uninteresting commands or skip the description - # the list is just too long [snap] ...because a) effectively skips the description, as the 'git help -a' command does not (yet?) provide such information. If you prefer the more verbose hardcoded listing, and think that the comment is still right, because you should better be able to skip uninteresting commands, you may use the ignored-patterns style, to weed out things you don't want. For example, if you'd like the completion to skip subcommands starting with 'diff-' and 'merge-' (while keeping 'merge' and 'diff'), do: zstyle ':completion::*:git:*' ignored-patterns '(diff|merge)-*' As far as I am concerned, that gives me all the possibilities I would want (for now) from the '_git_commands' part of '_git'. (Nikolai: I wanted to check your _git-repo this morning, to see, if you addressed this one already. However I got an 'Access denied.'.) Regards, Frank Index: Completion/Unix/Command/_git =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v retrieving revision 1.4 diff -u -r1.4 _git --- Completion/Unix/Command/_git 14 Jun 2007 14:42:37 -0000 1.4 +++ Completion/Unix/Command/_git 23 Jun 2007 09:58:27 -0000 @@ -74,110 +74,117 @@ tags_fetch_arg=('(-t --tags)'{-t,--tags}'[fetch remote tags]') -# TODO: either skip uninteresting commands or skip the description - the list -# is just too long _git_commands () { - local -a commands + local -a commands aliases - commands=( - 'add:add paths to the index' - 'am:apply patches from a mailbox (cooler than applymbox)' - 'apply:apply patch on a git index file and a work tree' - 'applymbox:apply patches from a mailbox' - 'applypatch:apply one patch extracted from an e-mail' - 'archimport:import an Arch repository into git' - 'bisect:find the change that introduced a bug' - 'branch:create and show branches' - 'cat-file:provide content or type information for repository objects' - 'check-ref-format:makes sure that a reference-name is well formed' - 'checkout:checkout and switch to a branch' - 'checkout-index:copy files from the index to the working directory' - 'cherry:find commits not merged upstream' - 'cherry-pick:cherry-pick the effect of an existing commit' - 'clone:clones a repository into a new directory' - 'clone-pack:clones a repository into the current repository (transport)' - 'commit:record changes to the repository' - 'commit-tree:creates a new commit object' - 'convert-objects:converts old-style git repository' - 'count-objects:count unpacked objects and display their disk consumption' - 'cvsimport:import a CVS "repository" into a git repository' - 'daemon:starts a really simple server for git repositories' - 'diff:show changes between commits, commit and working tree, etc.' - 'diff-files:compares files in the working tree and the index' - 'diff-index:compares content and mode of blobs between index and repository' - 'diff-stages:compares two "merge states" in the index file' - 'diff-tree:compares the content and mode of blobs found via two tree objects' - 'fetch:download objects and a head from another repository' - 'fetch-pack:receive missing objects from another repository' - 'format-patch:prepare patches for e-mail submission' - 'fsck-objects:verifies the connectivity and validity of the objects in the database' - 'get-tar-commit-id:extract commit ID from an archive created using tar-tree' - 'grep:print lines matching a pattern' - 'hash-object:computes the object ID from a file' - 'http-fetch:downloads a remote git repository via HTTP' - 'index-pack:build pack index file for an existing packed archive' - 'init-db:creates an empty git object database' - 'local-fetch:duplicates another git repository on a local system' - 'log:shows commit logs' - 'lost-found:recovers lost references that luckily have not yet been pruned' - 'ls-files:information about files in the index/working directory' - 'ls-remote:shows references in a remote or local repository' - 'ls-tree:displays a tree object in human-readable form' - 'mailinfo:extracts patch from a single e-mail message' - 'mailsplit:splits an mbox file into a list of files' - 'merge:grand unified merge driver' - 'merge-base:finds a good common ancestor as possible for a merge' - 'merge-index:runs a merge for files needing merging' - 'merge-one-file:standard helper-program to use with merge-index' - 'mktag:creates a tag object' - 'mv:moves or renames a file, directory, or symlink' - 'name-rev:find symbolic names for given revisions' - 'octopus:merges more than two commits' - 'pack-objects:creates a packed archive of objects' - 'parse-remote:routines to help parsing $GIT_DIR/remotes/' - 'patch-id:computes unique ID for a apatch' - 'peek-remote:lists references on a remote repository using the upload-pack protocol' - 'prune:prunes all unreachable objects from the object database' - 'prune-packed:removes extra objects that are already in pack files' - 'pull:fetch from and merge with a remote repository' - 'push:update remote refs along with associated objects' - 'read-tree:reads tree information into the directory index' - 'rebase:rebases local commits to new upstream head' - 'receive-pack:command invoked by send-pack to receive what is pushed to it' - 'relink:hardlinks acommon objects in local repositories' - 'repack:packs unpacked objects in a repository' - 'request-pull:generates a summary of pending changes' - 'reset:resets current HEAD to the specified state' - 'resolve:merges two commits' - 'rev-list:lists commit object in reverse chronological order' - 'rev-parse:picks out and massages parameters for other git commands' - 'revert:reverts an existing commit' - 'send-email:sends patch-e-mails out of "format-patch --mbox" output' - 'send-pack:pushes to a remote repository, intelligently' - 'shortlog:summarizes git log output' - 'show-branch:shows branches and their commits' - 'show-index:displays contents of a pack idx file' - 'ssh-fetch:pulls from a remote repository over an SSH connection' - 'ssh-upload:helper "server-side" program used by ssh-fetch' - "status:shows the working-tree's status" - 'stripspace:filters out empty lines' - 'svnimport:imports a SVN repository into git' - 'symbolic-ref:reads and modifies symbolic references' - 'tag:creates a tag object signed with GPG' - 'tar-tree:creates a tar archive of the files in the named tree' - "unpack-file:creates a temporary file with a blob's contents" - 'unpack-objects:unpacks objects out of a packed archive' - 'update-index:modifies the index in some given way' - 'update-ref:updates the object name stored in a reference safely' - 'update-server-info:updates auxiliary information on a dumb server' - 'upload-pack:command invoked by clone-pack and fetch-pack' - 'var:displays a git logical variable' - 'verify-pack:validates packed git archive files' - 'verify-tag:checks the GPG signature of a tag' - 'whatchanged:shows commit-logs and differences they introduce' - 'write-tree:creates a tree from the current index') + if zstyle -t ":completion:${curcontext}:" list_allcmds ; then + commands=(${(s: :)${(M)${(f)"$(git help -a)"}:# ##*}}) + else + commands=( + 'add:add paths to the index' + 'am:apply patches from a mailbox (cooler than applymbox)' + 'apply:apply patch on a git index file and a work tree' + 'applymbox:apply patches from a mailbox' + 'applypatch:apply one patch extracted from an e-mail' + 'archimport:import an Arch repository into git' + 'bisect:find the change that introduced a bug' + 'branch:create and show branches' + 'cat-file:provide content or type information for repository objects' + 'check-ref-format:makes sure that a reference-name is well formed' + 'checkout:checkout and switch to a branch' + 'checkout-index:copy files from the index to the working directory' + 'cherry:find commits not merged upstream' + 'cherry-pick:cherry-pick the effect of an existing commit' + 'clone:clones a repository into a new directory' + 'clone-pack:clones a repository into the current repository (transport)' + 'commit:record changes to the repository' + 'commit-tree:creates a new commit object' + 'convert-objects:converts old-style git repository' + 'count-objects:count unpacked objects and display their disk consumption' + 'cvsimport:import a CVS "repository" into a git repository' + 'daemon:starts a really simple server for git repositories' + 'diff:show changes between commits, commit and working tree, etc.' + 'diff-files:compares files in the working tree and the index' + 'diff-index:compares content and mode of blobs between index and repository' + 'diff-stages:compares two "merge states" in the index file' + 'diff-tree:compares the content and mode of blobs found via two tree objects' + 'fetch:download objects and a head from another repository' + 'fetch-pack:receive missing objects from another repository' + 'format-patch:prepare patches for e-mail submission' + 'fsck-objects:verifies the connectivity and validity of the objects in the database' + 'get-tar-commit-id:extract commit ID from an archive created using tar-tree' + 'grep:print lines matching a pattern' + 'hash-object:computes the object ID from a file' + 'http-fetch:downloads a remote git repository via HTTP' + 'index-pack:build pack index file for an existing packed archive' + 'init-db:creates an empty git object database' + 'local-fetch:duplicates another git repository on a local system' + 'log:shows commit logs' + 'lost-found:recovers lost references that luckily have not yet been pruned' + 'ls-files:information about files in the index/working directory' + 'ls-remote:shows references in a remote or local repository' + 'ls-tree:displays a tree object in human-readable form' + 'mailinfo:extracts patch from a single e-mail message' + 'mailsplit:splits an mbox file into a list of files' + 'merge:grand unified merge driver' + 'merge-base:finds a good common ancestor as possible for a merge' + 'merge-index:runs a merge for files needing merging' + 'merge-one-file:standard helper-program to use with merge-index' + 'mktag:creates a tag object' + 'mv:moves or renames a file, directory, or symlink' + 'name-rev:find symbolic names for given revisions' + 'octopus:merges more than two commits' + 'pack-objects:creates a packed archive of objects' + 'parse-remote:routines to help parsing $GIT_DIR/remotes/' + 'patch-id:computes unique ID for a apatch' + 'peek-remote:lists references on a remote repository using the upload-pack protocol' + 'prune:prunes all unreachable objects from the object database' + 'prune-packed:removes extra objects that are already in pack files' + 'pull:fetch from and merge with a remote repository' + 'push:update remote refs along with associated objects' + 'read-tree:reads tree information into the directory index' + 'rebase:rebases local commits to new upstream head' + 'receive-pack:command invoked by send-pack to receive what is pushed to it' + 'relink:hardlinks acommon objects in local repositories' + 'repack:packs unpacked objects in a repository' + 'request-pull:generates a summary of pending changes' + 'reset:resets current HEAD to the specified state' + 'resolve:merges two commits' + 'rev-list:lists commit object in reverse chronological order' + 'rev-parse:picks out and massages parameters for other git commands' + 'revert:reverts an existing commit' + 'send-email:sends patch-e-mails out of "format-patch --mbox" output' + 'send-pack:pushes to a remote repository, intelligently' + 'shortlog:summarizes git log output' + 'show-branch:shows branches and their commits' + 'show-index:displays contents of a pack idx file' + 'ssh-fetch:pulls from a remote repository over an SSH connection' + 'ssh-upload:helper "server-side" program used by ssh-fetch' + "status:shows the working-tree's status" + 'stripspace:filters out empty lines' + 'svnimport:imports a SVN repository into git' + 'symbolic-ref:reads and modifies symbolic references' + 'tag:creates a tag object signed with GPG' + 'tar-tree:creates a tar archive of the files in the named tree' + "unpack-file:creates a temporary file with a blob's contents" + 'unpack-objects:unpacks objects out of a packed archive' + 'update-index:modifies the index in some given way' + 'update-ref:updates the object name stored in a reference safely' + 'update-server-info:updates auxiliary information on a dumb server' + 'upload-pack:command invoked by clone-pack and fetch-pack' + 'var:displays a git logical variable' + 'verify-pack:validates packed git archive files' + 'verify-tag:checks the GPG signature of a tag' + 'whatchanged:shows commit-logs and differences they introduce' + 'write-tree:creates a tree from the current index' + ) + fi _describe -t commands 'git command' commands && ret=0 + if zstyle -t ":completion:${curcontext}:" list_aliases ; then + aliases=(${${${(f)"$(git-config --get-regexp 'alias\..*')"}/(#s)alias./}/ ##/:}) + _describe -t aliases 'git command alias' aliases && ret=0 + fi } # TODO: this needs to be cleaned up and fixed