From ab5111a5cb09eeeae0db356c261cf02c1a43755c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 25 Nov 2005 12:52:23 +0000 Subject: 22031: new git completion --- Completion/Unix/Command/_git | 1348 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1348 insertions(+) create mode 100644 Completion/Unix/Command/_git (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git new file mode 100644 index 000000000..7b76d5a90 --- /dev/null +++ b/Completion/Unix/Command/_git @@ -0,0 +1,1348 @@ +#compdef git git-apply git-checkout-index git-commit-tree git-hash-object git-index-pack git-init-db git-merge-index git-mktag git-pack-objects git-prune-packed git-read-tree git-unpack-objects git-update-index git-write-tree git-cat-file git-diff-index git-diff-files git-diff-stages git-diff-tree git-fsck-objects git-ls-files git-ls-tree git-merge-base git-name-rev git-rev-list git-show-index git-tar-tree git-unpack-file git-var git-verify-pack git-clone-pack git-fetch-pack git-http-fetch git-local-fetch git-peek-remote git-receive-pack git-send-pack git-ssh-fetch git-ssh-upload git-update-server-info git-upload-pack git-add git-am git-applymbox git-bisect git-branch git-checkout git-cherry-pick git-clone git-commit git-diff git-fetch git-format-patch git-grep git-log git-ls-remote git-merge git-mv git-octopus git-pull git-push git-rebase git-repack git-reset git-resolve git-revert git-shortlog git-show-branch git-status git-verify-tag git-whatchanged git-applypatch git-archimport git-convert-objects git-cvsimport git-lost-found git-merge-one-file git-prune git-relink git-svnimport git-symbolic-ref git-tag git-update-ref git-check-ref-format git-cherry git-count-objects git-daemon git-get-tar-commit-id git-mailinfo git-mailsplit git-patch-id git-request-pull git-send-email git-stripspace + +# Commands not completed: +# git-sh-setup +# git-shell +# git-parse-remote +# git-rev-parse + +# TODO: most commands need a valid git repository to run, so add a check for it +# so that we can make our handling a little bit cleaner (need to deal with +# GIT_DIR=... stuff as pre-command modifier) + +# TODO: suggested zstyles: +# +# zstyle ':completion::*:git-{name-rev,add,rm}:*' ignore-line true + +typeset -g nul_arg= + +nul_arg='-z[use NUL termination on output]' + +typeset -ga diff_args + +# TODO: -s and --diff-filter are undocumented +diff_args=( + '--diff-filter=-[filter to apply to diff]' + '--find-copies-harder[try harder to find copies]' + '--name-only[show only names of changed files]' + '--name-status[show only names and status of changed files]' + '--pickaxe-all[when -S finds a change, show all changes in that changeset]' + '-B-[break complete rewrite changes into pairs of given size]: :_guard "[[\:digit\:]]#" size' + '-C-[detect copies as well as renames with given score]: :_guard "[[\:digit\:]]#" size' + '-l-[number of rename/copy targets to run]: :_guard "[[\:digit\:]]#" number' + '-M-[detect renames with given score]: :_guard "[[\:digit\:]]#" size' + '-O-[output patch in the order of glob-pattern lines in given file]:file:_files' + '-p[generate diff in patch format]' + '-R[do a reverse diff]' + '-S-[look for differences that contain the given string]:string' + '-s[do not produce any output]' + '-u[synonym for -p]' + $nul_arg +) + +typeset -g pretty_arg= +pretty_arg='--pretty=-[pretty print commit messages]::pretty print:((raw\:"the raw commits" + medium\:"most parts of the messages" + short\:"few headers and only subject of messages" + full\:"all parts of the commit messages" + oneline\:"commit-ids and subject of messages"))' + +typeset -g exec_arg= +exec_arg='--exec=-[specify path to git-upload-pack on remote side]:remote path' + +typeset -ga fetch_args + +fetch_args=( + '-a[fetch all objects]' + '-c[fetch commit objects]' + '--recover[recover from a failed fetch]' + '-t[fetch trees associated with commit objects]' + '-v[show what is downloaded]' + '-w[write out the given commit-id to the given file]:new file' +) + +typeset -ga merge_strategy + +merge_strategy=( + '(-s --strategy)'{-s,--strategy=}'[use given merge strategy]:strategy:(octopus recursive resolve stupid)') + +typeset -ga force_ref_arg + +force_ref_arg=('(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]') + +typeset -ga tags_fetch_arg + +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 + + 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