diff options
Diffstat (limited to 'Completion/Unix/Command')
| -rw-r--r-- | Completion/Unix/Command/_git | 318 |
1 files changed, 276 insertions, 42 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ade0b02f1..af1f8a811 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1,10 +1,4 @@ -#compdef git git-add git-am git-annotate git-apply git-applymbox git-applypatch git-archimport git-archive git-bisect git-blame git-branch git-cat-file git-check-ref-format git-checkout git-checkout-index git-cherry git-cherry-pick git-clean git-clone git-clone-pack git-commit git-commit-tree git-convert-objects git-count-objects git-cvsexportcommit git-cvsimport git-daemon git-describe git-diff git-diff-files git-diff-index git-diff-stages git-diff-tree git-fast-import git-fetch git-fetch-pack git-fmt-merge-msg git-format-patch git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object git-http-fetch git-http-push git-imap-send git-index-pack git-init git-instaweb git-local-fetch git-log git-lost-found git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file git-merge-index git-merge-one-file git-merge-tree git-mktag git-mktree git-mv git-name-rev git-octopus git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-peek-remote git-prune git-prune-packed git-pull git-push git-quiltimport git-read-tree git-rebase git-receive-pack git-reflog git-relink git-remote git-repack gut-runstatus git-config git-request-pull git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-email git-send-pack git-shortlog git-show git-show-branch git-show-index git-ssh-fetch git-ssh-upload git-status git-stripspace git-svn git-svnimport git-symbolic-ref git-tag git-tar-tree git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-pack git-var git-verify-pack git-verify-tag git-whatchanged git-write-tree - -# Commands not completed: -# git-cvsserver -# git-parse-remote -# git-shell -# git-sh-setup +#compdef git git-add git-am git-annotate git-apply git-applymbox git-applypatch git-archimport git-archive git-bisect git-blame git-branch git-cat-file git-check-attr git-check-ref-format git-checkout git-checkout-index git-cherry git-cherry-pick git-clean git-clone git-clone-pack git-commit git-commit-tree git-convert-objects git-count-objects git-cvsexportcommit git-cvsimport git-cvsserver git-daemon git-describe git-diff git-diff-files git-diff-index git-diff-stages git-diff-tree git-fast-import git-fetch git-fetch-pack git-fmt-merge-msg git-for-each-ref git-format-patch git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object git-http-fetch git-http-push git-imap-send git-index-pack git-init git-instaweb git-local-fetch git-log git-lost-found git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file git-merge-index git-merge-one-file git-merge-tree git-mktag git-mktree git-mv git-name-rev git-octopus git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-peek-remote git-prune git-prune-packed git-pull git-push git-quiltimport git-read-tree git-rebase git-receive-pack git-reflog git-relink git-remote git-repack gut-runstatus git-config git-request-pull git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-email git-send-pack git-sh-setup git-shell git-shortlog git-show git-show-branch git-show-index git-show-ref git-ssh-fetch git-ssh-upload git-status git-stripspace git-svn git-svnimport git-symbolic-ref git-tag git-tar-tree git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-archive git-upload-pack git-var git-verify-pack git-verify-tag git-whatchanged git-write-tree # TODO: All if (( words[(I)-option] )) should be turned into # if (( words[(I)-option] > 0 && words[(I)-option] < CURRENT )), as the user @@ -21,7 +15,7 @@ nul_arg='-z[use NUL termination on output]' declare -g abbrev_arg -abbrev_arg='--abbrev=-[set minimum SHA1 display-length]: :_guard "[[\:digit\:]]##" length' +abbrev_arg='--abbrev=-[set minimum SHA1 display-length]: :_guard "[[\:digit\:]]#" length' declare -g find_copies_harder_arg= @@ -84,12 +78,12 @@ exec_arg='--exec=-[specify path to git-upload-pack on remote side]:remote path' declare -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]' + '-a[fetch all objects]' '-v[show what is downloaded]' '-w[write commit-id into the filename under "$GIT_DIR/refs/<filename>"]:filename' + '--recover[recover from a failed fetch]' ) declare -ga merge_args @@ -128,11 +122,15 @@ verbose_arg='-v[produce verbose output]' declare -g help_arg= help_arg='-h[display usage information]' +declare -ga upload_pack_arg +upload_pack_arg=('(-u --upload-pack)'{-u,--upload-pack=-}'[specify path to git-upload-pack on remote side]:remote path') + + declare -ga common_fetch_args common_fetch_args=( '(-a --append)'{-a,--append}'[append ref names and object names of fetched refs to "$GIT_DIR/FETCH_HEAD"]' - '--upload-pack[pass --exec=<upload-pack> to git-fetch-pack]:remote pack' + $upload_pack_arg $force_ref_arg $tags_fetch_arg '(-k --keep)'{-k,--keep}'[keep downloaded pack]' @@ -155,6 +153,9 @@ declare -g shared_arg= shared_arg='--shared=-[share repository amongst several users]::permissions:__git_repository_permissions' +declare -g thin_arg= +thin_arg='--thin[minimize number of objects to be sent]' + __git_zstyle_default () { zstyle -t $1 $2 if (( $status == 2 )); then @@ -207,6 +208,7 @@ _git_commands () { 'archive:create an archive of files from a named tree' 'blame:blame file lines on commits' 'cat-file:provide content or type information for repository objects' + 'check-attr:display gitattributes information' 'check-ref-format:makes sure that a reference-name is well formed' 'checkout-index:copy files from the index to the working directory' 'cherry:find commits not merged upstream' @@ -220,7 +222,6 @@ _git_commands () { 'diff-stages:compare two "merge states" in the index file' 'diff-tree:compare the content and mode of blobs found via two tree objects' 'fetch-pack:receive missing objects from another repository' - 'fmt-merge-msg:produce merge commit message' 'imap-send:dump mailbox from stdin into imap folder' 'index-pack:build pack index file for an existing packed archive' 'local-fetch:duplicate another git repository on a local system' @@ -231,7 +232,6 @@ _git_commands () { 'merge-base:find as good a common ancestor as possible for a merge' 'merge-file:run a three-way file merge' 'merge-index:run merge for files needing merging' - 'merge-one-file:standard helper-program to use with merge-index' 'merge-tree:show three-way merge without touching index' 'mktag:create tag object' 'mktree:build tree-object from ls-tree formatted text' @@ -253,6 +253,7 @@ _git_commands () { 'shortlog:summarize git log output' 'show:show various types of objects' 'show-index:display contents of a pack idx file' + 'show-ref:list references in a local repository' 'symbolic-ref:read and modify symbolic references' 'tar-tree:create tar archive of the files in the named tree' "unpack-file:create temporary file with blob's contents" @@ -269,7 +270,7 @@ _git_commands () { 'format-patch:prepare patches for e-mail submission' 'ls-files:information about files in the index/working directory' 'config:get and set options in "$GIT_DIR/config"' - 'instaweb:insantly browse your working repository in gitweb' + 'instaweb:instantly browse your working repository in gitweb' 'remote:manage set of tracked repositories' 'send-email:send patch-e-mails out of "format-patch" output' 'update-index:modify index in some given way') @@ -286,6 +287,7 @@ _git_commands () { local -a ancillary_commands ancillary_commands=( 'convert-objects:convert old-style git repository' + 'for-each-ref:output information on each ref' 'get-tar-commit-id:extract commit ID from an archive created using tar-tree' 'hash-object:compute object ID from a file' 'patch-id:compute unique ID for a patch' @@ -296,15 +298,19 @@ _git_commands () { internal_commands=( 'daemon:start a really simple server for git repositories' 'fast-import:import information into git directly' + 'fmt-merge-msg:produce merge commit message' 'http-fetch:download remote git repository via HTTP' 'http-push:push missing objects using HTTP/DAV' + 'merge-one-file:standard helper-program to use with merge-index' 'receive-pack:command invoked by send-pack to receive what is pushed to it' 'rev-parse:pick out and massage parameters for other git commands' 'runstatus:a helper for git-status and git-commit' 'send-pack:push to remote repository, intelligently' + 'shell:restricted login shell for GIT-only SSH access' 'ssh-fetch:pull from remote repository over an SSH connection' 'ssh-upload:"server-side" helper program used by ssh-fetch' 'stripspace:filter out empty lines' + 'upload-archive:send archive back to git-archive' 'upload-pack:command invoked by clone-pack and fetch-pack') local wanted_commands @@ -890,9 +896,30 @@ _git-diff-tree () { esac } +# TODO: Better completion for --format: should complete %(field) stuff, that +# is, %(refname), %(objecttype), %(objectsize), %(objectname) with optional ‘*’ +# in front. +# TODO: Documentation says that --count can be given * number of times, but +# sources beg to differ, allowing only one. +(( $+functions[_git-for-each-ref] )) || +_git-for-each-ref () { + _arguments -S \ + '--format=-[output format of ref information]:format' \ + '(-s --shell -p --perl --python --tcl)'{-s,--shell}'[use string literals suitable for sh]' \ + '(-s --shell -p --perl --python --tcl)'{-p,--perl}'[use string literals suitable for Perl]' \ + '(-s --shell -p --perl --tcl)'--python'[use string literals suitable for Python]' \ + '(-s --shell -p --perl --python )'--tcl'[use string literals suitable for Tcl]' \ + '--count=-[maximum number of refs to iterate over]: :_guard "[[\:digit\:]]#" "maximum number of refs"' \ + '--sort=-[key to sort refs by]:sort key:__git_ref_sort_keys' \ + ':: :_guard "([^-]?#|)" pattern' && ret=0 +} + (( $+functions[_git-fmt-merge-msg] )) || _git-fmt-merge-msg () { - _message "you probably should not be issuing this command" + arguments \ + '( --no-summary)--summary[add one-line descriptions from commits being merged]' \ + '(--summary )--no-summary[do not add one-line descriptions from commits being merged]' \ + '(-F --file)'{-F,--file}'[specify list of merged objects from file]:file:_files' && ret=0 } (( $+functions[_git-fsck] )) || @@ -909,6 +936,12 @@ _git-fsck () { (( $+functions[_git-ls-files] )) || _git-ls-files () { + local no_empty_directory_arg + + if (( words[(I)--directory] )); then + no_empty_directory_arg='--no-empty-directory[do not list empty directories]' + fi + _arguments -S \ $nul_arg \ '(-c --cached)'{-c,--cached}'[show cached files in the output]' \ @@ -918,15 +951,17 @@ _git-ls-files () { '(-m --modified)'{-m,--modified}'[show modified files in the output]' \ '(-o --others)'{-o,--others}'[show other files in the output]' \ '(-s --stage)'{-s,--stage}'[show stage files in the output]' \ - '(-t -v)-t[identify each files status (HMRCK?)]' \ '(-u --unmerged)'{-u,--unmerged}'[show unmerged files in the output]' \ - '(-t -v)-v[identify each files status (hmrck?)]' \ + '( -v)-t[identify each files status (HMRCK?)]' \ + '(-t )-v[identify each files status (hmrck?)]' \ '*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \ '*'{-X,--exclude-from=-}'[skip files matching patterns in given file]:file:_files' \ '*--exclude-per-directory=-[skip directories matching patterns in given file]:file:_files' \ '--directory[if a whole directory is classified as "other", show just its name]' \ + $no_empty_directory_arg \ '--error-unmatch[if any <file> does not appear in the index, treat this as an error]' \ '--full-name[force paths to be output relative to the project top directory]' \ + $abbrev_arg \ '*::index file:_files' && ret=0 } @@ -942,6 +977,7 @@ _git-ls-tree () { {--name-only,--name-status}'[list only filenames, one per line]' \ '-r[recurse into subdirectories]' \ '-t[show tree entries even when going to recurse them]' \ + '--full-name[output full path-names]' \ ':tree-ish:__git_tree_ishs' \ '*::tree file:->files' && ret=0 @@ -977,6 +1013,7 @@ _git-merge-base () { _git-name-rev () { _arguments -S \ '--tags[only use tags to name the commits]' \ + '--refs=-[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \ '(--stdin :)--all[list all commits reachable from all refs]' \ '(--all :)--stdin[read from stdin and append revision-name]' \ '(--stdin --all)*:commit-ish:__git_revisions' && ret=0 @@ -1006,13 +1043,32 @@ _git-rev-list () { _arguments -S \ $revision_arguments \ '(--pretty)--header[show commit headers]' \ + '--remote-empty[stop when a given path disappears from the tree]' \ '--timestamp[undocumented]' \ - '--bisect[show only the middlemost commit object]' \ + '( --bisect-vars)--bisect[show only the middlemost commit object]' \ + '(--bisect )--bisect-vars[same as --bisect, outputing shell-evalable code]' \ '--stdin[read commit objects from standard input]' \ '*:commit id:__git_commits2' && ret=0 fi } +(( $+functions[_git-show-ref] )) || +_git-show-ref () { + _arguments -S \ + - list \ + '(-h --head)'{-h,--head}'[show the HEAD reference]' \ + '--tags[show only "refs/tags"]' \ + '--heads[show only "refs/heads"]' \ + '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \ + '(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :_guard "[[\:digit\:]]#" length' \ + '--verify[enable stricter reference checking]' \ + $abbrev_arg \ + '(-q --quiet)'{-q,--quiet}'[do not print any results to stdout]' \ + '*: :_guard "([^-]?#|)" pattern' \ + - exclude \ + '--exclude-existing=-[filter out existing refs from stdin]:: :_guard "([^-]?#|)" pattern' && ret=0 +} + (( $+functions[_git-show] )) || _git-show () { declare -a revision_arguments @@ -1032,6 +1088,7 @@ _git-show-index () { (( $+functions[_git-tar-tree] )) || |
