summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_git
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
committerJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
commit26e09889646be3ea65b4a3dfeda26213e4bb6a27 (patch)
tree4f3c73a9416bf47ad7e125383d23cf42879e38d7 /Completion/Unix/Command/_git
parent841bce705a58b04220b1f257abcc00ae71cbdbdc (diff)
parent001cba48ce3b964cf01fb3e2af54b20eacbc9bf5 (diff)
downloadzsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.tar.gz
zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_git')
-rw-r--r--Completion/Unix/Command/_git779
1 files changed, 551 insertions, 228 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index cecb80ac3..702360ef3 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -76,17 +76,21 @@ _git-add () {
case $state in
(file)
- declare -a ignored_files_alternatives
+ declare -a file_alternatives
+ if [[ -z ${opt_args[(I)-u|--update]} ]]; then
+ file_alternatives=(
+ 'other-files::__git_ignore_line_inside_arguments __git_other_files'
+ )
+ fi
if [[ -n ${opt_args[(I)-f|--force]} ]]; then
- ignored_files_alternatives=(
+ file_alternatives+=(
'ignored-modified-files:ignored modified file:__git_ignore_line_inside_arguments __git_modified_files --ignored'
'ignored-other-files:ignored other file:__git_ignore_line_inside_arguments __git_other_files --ignored')
fi
_alternative \
'modified-files::__git_ignore_line_inside_arguments __git_modified_files' \
- 'other-files::__git_ignore_line_inside_arguments __git_other_files' \
- $ignored_files_alternatives && ret=0
+ $file_alternatives && ret=0
;;
esac
@@ -119,7 +123,11 @@ _git-am () {
$apply_options \
'--quit[abort the patching operation but keep HEAD where it is]' \
'--show-current-patch=-[show the message being applied]::show [raw]:(diff raw)' \
+ '--retry[try to apply current patch again]' \
+ '(--empty)--allow-empty[record the empty patch as an empty commit]' \
+ '(--allow-empty)--empty=[select handling of empty patches]:handling [stop]:(stop drop keep)' \
'(-i --interactive)'{-i,--interactive}'[apply patches interactively]' \
+ '(-n --no-verify)'{-n,--no-verify}'[bypass pre-applypatch and applypatch-msg hooks]' \
'--committer-date-is-author-date[use author date as committer date]' \
'--ignore-date[use committer date as author date]' \
'--skip[skip the current patch]' \
@@ -160,8 +168,10 @@ _git-archive () {
'--format=-[format of the resulting archive]:archive format:__git_archive_formats' \
'(- :)'{-l,--list}'[list available archive formats]' \
'(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
+ '--mtime=[set modification time of archive entries]:mtime' \
'--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \
'--add-file=[add untracked file to archive]:file:_files' \
+ '--add-virtual-file=[add untracked file to archive]:path:_files' \
'(-o --output)'{-o+,--output=}'[write archive to specified file]:archive:_files' \
'--worktree-attributes[look for attributes in .gitattributes in working directory too]' \
$backend_args \
@@ -269,6 +279,7 @@ _git-bisect () {
_arguments -C -s \
$log_options \
$revision_options && ret=0
+ ;;
(*)
_nothing
;;
@@ -329,7 +340,8 @@ _git-branch () {
"(- :)--show-current[show current branch name]" \
"($l $m $d)--create-reflog[create the branch's reflog]" \
"($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \
- "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \
+ "($l $m $d --track)-t[setup configuration so that pull merges from the start point]" \
+ "($l $m $d -t)--track=-[setup configuration so that pull merges from the start point]::upstream tracking:(direct inherit)" \
"($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
"($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote branch:__git_remote_branch_names' \
"($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
@@ -341,6 +353,7 @@ _git-branch () {
$dependent_creation_args \
"($l $c $d $m)"{-m,--move}"[rename a branch and the corresponding reflog]" \
"($l $c $d $m)-M[rename a branch even if the new branch-name already exists]" \
+ "--omit-empty[don't output a newline after empty formatted refs]" \
"($l $c $d $m)"{-c,--copy}"[copy a branch and the corresponding reflog]" \
"($l $c $d $m)-C[copy a branch even if the new branch-name already exists]" \
$dependent_modification_args \
@@ -350,6 +363,7 @@ _git-branch () {
'*--sort=[specify field to sort on]: :__git_ref_sort_keys' \
'--points-at=[only list tags of the given object]: :__git_commits' \
"($c $m $d -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \
+ "($l $m $d)--recurse-submodules[recurse through submodules]" \
$dependent_deletion_args
}
@@ -383,13 +397,12 @@ _git-bundle () {
_arguments \
'(-q --quiet)'{-q,--quiet}"[don't show progress]" \
'--progress[show progress meter]' \
- '--all-progress[show progress meter during object writing phase]' \
- '--all-progress-implied[similar to --all-progress when progress meter is shown]' \
+ \!--all-progress{,-implied} \
'--version=[specify bundle format version]:version:(2 3)' \
':bundle:_files' && ret=0
else
local revision_options
- __git_setup_revision_options
+ __git_setup_revision_options -d
_arguments -S -s \
$revision_options \
@@ -464,17 +477,18 @@ _git-checkout () {
'(-q --quiet -2 --ours -3 --theirs --patch)'{-3,--theirs}'[check out stage #3 for unmerged paths]' \
'( -B --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \
'(-b --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \
- '(-t --track --orphan --patch -d --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \
+ '(--track --no-track --orphan --patch -d --detach)-t[set upstream info for new branch]' \
+ '(-t --no-track --orphan --patch -d --detach)--track=-[set upstream info for new branch]::configuration:(direct inherit)' \
'(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \
$new_branch_reflog_opt \
'(-b -B -t --track --patch --orphan -d --detach)'{-d,--detach}'[detach the HEAD at named commit]' \
'(-b -B -t --track --patch -d --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \
'(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \
- '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3)' \
+ '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3 zdiff3)' \
'(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \
"--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \
"--no-guess[don't second guess 'git checkout <no-such-branch>']" '!(--no-guess)--guess' \
- "--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \
+ "--ignore-other-worktrees[don't check if another worktree is using this branch]" \
'--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \
'--no-overlay[remove files from index or working tree that are not in the tree-ish]' \
'(-q --quiet --progress)--no-progress[suppress progress reporting]' \
@@ -529,26 +543,30 @@ _git-cherry-pick () {
local -a git_commit_opts
git_commit_opts=(--all --not HEAD --not)
_arguments \
- '(- :)--quit[end revert or cherry-pick sequence]' \
- '(- :)--continue[resume revert or cherry-pick sequence]' \
- '(- :)--skip[skip current commit and continue]' \
- '(- :)--abort[cancel revert or cherry-pick sequence]' \
+ - init \
'--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' \
'--allow-empty[preserve initially empty commits]' \
'--allow-empty-message[allow replaying a commit with an empty message]' \
- '--keep-redundant-commits[keep cherry-picked commits that will become empty]' \
+ '!(--empty)--keep-redundant-commits' \
+ '--empty=[how to handle commits that become empty]:handling:(stop drop keep)' \
'(-e --edit --ff)'{-e,--edit}'[edit commit before committing the cherry-pick]' \
'(--ff)-x[append information about what commit was cherry-picked]' \
'(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \
- '--rerere-autoupdate[update index with reused conflict resolution if possible]' \
+ '(--no-rerere-autoupdate)--rerere-autoupdate[update index with reused conflict resolution if possible]' \
+ '(--rerere-autoupdate)--no-rerere-autoupdate' \
'(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \
'(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
- '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
+ '*--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \
'*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
'(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \
- '*: : __git_commit_ranges -O expl:git_commit_opts'
+ '*: : __git_commit_ranges -O expl:git_commit_opts' \
+ - '(sequencer)' \
+ '--quit[end revert or cherry-pick sequence]' \
+ '--continue[resume revert or cherry-pick sequence]' \
+ '--skip[skip current commit and continue]' \
+ '--abort[cancel revert or cherry-pick sequence]' \
}
(( $+functions[_git-citool] )) ||
@@ -642,22 +660,24 @@ _git-clone () {
'(-u --upload-pack)'{-u+,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \
'--template=[directory to use as a template for the object database]: :_directories' \
'*'{-c,--config}'[<key>=<value> set a configuration variable in the newly created repository]' \
- '--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \
- '--shallow-since=[shallow clone since a specific time]:time' \
- '*--shallow-exclude=[shallow clone excluding commits reachable from specified remote revision]:revision' \
+ '(--bundle-uri)--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \
+ '(--bundle-uri)--shallow-since=[shallow clone since a specific time]:time' \
+ '(--bundle-uri)*--shallow-exclude=[shallow clone excluding commits reachable from specified remote revision]:revision' \
'(--no-single-branch)--single-branch[clone only history leading up to the main branch or the one specified by -b]' \
'(--single-branch)--no-single-branch[clone history leading up to each branch]' \
"--no-tags[don't clone any tags and make later fetches not follow them]" \
'--shallow-submodules[any cloned submodules will be shallow]' \
- '--recursive[initialize all contained submodules]' \
'(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:__git_files' \
'--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \
+ '--ref-format=[specify reference format to use]:format:(files reftable)' \
\*--server-option='[send specified string to the server when using protocol version 2]:option' \
'(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
'(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
'--filter=[object filtering]:filter:_git_rev-list_filters' \
+ '--also-filter-submodules[apply partial clone filters to submodules]' \
'--remote-submodules[any cloned submodules will use their remote-tracking branch]' \
'--sparse[initialize the sparse-checkout file to start with only the top-level files]' \
+ '(--depth --shallow-since --shallow-exclude)--bundle-uri=[before fetching, get a bundle from specified location]:uri:_urls' \
': :->repository' \
': :_directories' && ret=0
@@ -710,10 +730,10 @@ _git-commit () {
"--no-ahead-behind[don't display detailed ahead/behind counts relative to upstream branch]" \
'(--short --dry-run)--porcelain[dry run with machine-readable output format]' \
'(--short --porcelain --dry-run -z --null)'{-z,--null}'[dry run with NULL-separated output format]' \
- {-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \
+ {-p,--patch}'[use the interactive patch selection interface to choose which changes to commit]' \
'(--reset-author)--author[override the author name used in the commit]:author name' \
'--date=[override the author date used in the commit]:date' \
- '*--trailer=[add custom trailer(s)]:trailer' \
+ '*--trailer=[add custom trailer]:trailer:__git_trailers_tokens' \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
'(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \
'--allow-empty[allow recording an empty commit]' \
@@ -722,8 +742,8 @@ _git-commit () {
'(-e --edit --no-edit)'{-e,--edit}'[edit the commit message before committing]' \
'(-e --edit --no-edit)--no-edit[do not edit the commit message before committing]' \
'--no-post-rewrite[bypass the post-rewrite hook]' \
- '(-a --all --interactive -o --only -i --include)'{-i,--include}'[update the given files and commit the whole index]' \
- '(-a --all --interactive -o --only -i --include)'{-o,--only}'[commit only the given files]' \
+ '(-a --all --interactive -o --only)*'{-i,--include}'[update the given files and commit the whole index]' \
+ '(-a --all --interactive -i --include)*'{-o,--only}'[commit only the given files]' \
'(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files"
normal\:"show untracked files and directories"
all\:"show individual files in untracked directories"))' \
@@ -779,6 +799,7 @@ _git-diff () {
_arguments -C -s $endopt \
$* \
$diff_options \
+ '--exit-code[report exit code 1 if differences, 0 otherwise]' \
'(--exit-code)--quiet[disable all output]' \
$diff_stage_options \
'(--cached --staged)--no-index[show diff between two paths on the filesystem]' \
@@ -808,18 +829,6 @@ _git-diff () {
# Otherwise, more complex conditions need to be checked.
case $CURRENT in
- (1)
- local files_alt='files::__git_changed-in-working-tree_files'
- if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
- files_alt='files::__git_changed-in-index_files'
- fi
-
- _alternative \
- 'commit-ranges::__git_commit_ranges' \
- 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
- $files_alt \
- 'blobs::__git_blobs ' && ret=0
- ;;
(2)
# Check if first argument is something special. In case of committish ranges and committishs offer a full list compatible completions.
if __git_is_committish_range $line[1]; then
@@ -841,10 +850,19 @@ _git-diff () {
elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
# Example: git diff --cached file1 <tab>
__git_changed-in-index_files && ret=0
- else
- # Example: git diff file1 <tab>
- __git_changed-in-working-tree_files && ret=0
fi
+ ;&
+ (1)
+ local files_alt='files::__git_changed-in-working-tree_files'
+ if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
+ files_alt='files::__git_changed-in-index_files'
+ fi
+
+ _alternative \
+ 'commit-ranges::__git_commit_ranges' \
+ 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
+ $files_alt \
+ 'blobs::__git_blobs ' && ret=0
;;
(*)
if __git_is_committish_range $line[1]; then
@@ -893,6 +911,7 @@ _git-fetch () {
'(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \
'(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \
'--prefetch[modify the refspec to place all refs within refs/prefetch/]' \
+ '--refetch[fetch all objects as a fresh clone would]' \
'(-P --prune-tags)'{-P,--prune-tags}'[prune local tags no longer on remote and clobber changed tags]' \
'--write-fetch-head[write fetched references to the FETCH_HEAD file]' \
"--negotiate-only[don't fetch a packfile; instead, print ancestors of negotiation tips]" \
@@ -931,6 +950,7 @@ _git-format-patch () {
# TODO: Should filter out --name-only, --name-status, and --check from
# $diff_options.
_arguments -C -S -s $endopt \
+ '-1[format only the specified commit itself]' \
$diff_options \
'--[limit the number of patches to prepare]: :__git_guard_number "number of patches to prepare"' \
'(-o --output-directory --stdout)'{-o+,--output-directory=}'[store resulting files in given directory]: :_directories' \
@@ -951,8 +971,9 @@ _git-format-patch () {
'--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \
'(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the <n>-th iteration of the topic]: :__git_guard_number iteration' \
'--filename-max-length=[specify max length of output filename]:length' \
- '(-k --keep-subject --subject-prefix)--rfc[use \[RFC PATCH\] instead of \[PATCH\]]' \
+ '(-k --keep-subject --subject-prefix)--rfc=-[use \[RFC PATCH\] instead of \[PATCH\]]::text [RFC]' \
"--cover-from-description=[generate parts of a cover letter based on a branch's description]:mode:(message default subject auto none)" \
+ '--description-file=[use branch description from file]:file:_files' \
'(-k --keep-subject --rfc)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \
'*--to=[add To: header to email headers]: :_email_addresses' \
'*--cc=[add Cc: header to email headers]: :_email_addresses' \
@@ -972,11 +993,12 @@ _git-format-patch () {
'--interdiff=[insert interdiff against previous patch series in cover letter or single patch]:reference to tip of previous series:__git_revisions' \
'--range-diff=[insert range-diff against previous patch series in cover letter or single patch]:reference to tip ot previous series:__git_revisions' \
'--creation-factor=[for range-diff, specify weighting for creation]:weighting (percent)' \
+ '--force-in-body-from[show in-body From: even if identical to the e-mail header]' \
': :->commit-or-commit-range' && ret=0
case $state in
(commit-or-commit-range)
- if [[ -n ${opt_args[(I)--root]} ]]; then
+ if [[ -n ${opt_args[(I)(--root|-1)]} ]]; then
__git_commits && ret=0
else
__git_commit_ranges && ret=0
@@ -992,8 +1014,10 @@ _git-gc () {
_arguments -S -s $endopt \
'--aggressive[more aggressively optimize]' \
'--auto[check whether housekeeping is required]' \
- '( --no-prune)--prune=-[prune loose objects older than given date]::date [2 weeks ago]:__git_datetimes' \
+ '--detach[perform garbage collection in the background]' \
+ '( --no-prune)--prune=-[prune loose objects older than given date]::date [2 weeks ago]:_git_approxidates' \
'(--prune )--no-prune[do not prune any loose objects]' \
+ '--cruft[pack unreferenced objects separately]' \
'(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' \
'--keep-largest-pack[repack all other packs except the largest pack]' \
}
@@ -1056,6 +1080,7 @@ _git-grep () {
'--threads=[use specified number of threads]:number of threads' \
'(-c --count -p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \
'(-c --count -W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \
+ '(-m --max-count)'{-m+,--max-count=}'[specify maximum number of results per file]:results' \
'(1)*-f+[read patterns from given file]:pattern file:_files' \
'(1)*-e+[use the given pattern for matching]:pattern' \
$pattern_operators \
@@ -1171,7 +1196,8 @@ _git-init () {
'--shared=[share repository amongst several users]:: :__git_repository_permissions' \
'--separate-git-dir=[create git dir elsewhere and link it using the gitdir mechanism]:: :_directories' \
'(-b --initial-branch)'{-b+,--initial-branch=}'[override the name of the initial branch]:branch name' \
- '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \
+ '--object-format=[specify hash algorithm to use]:algorithm:(sha1 sha256)' \
+ '--ref-format[specify reference format to use]:format' \
':: :_directories'
}
@@ -1188,7 +1214,7 @@ _git-interpret-trailers() {
'--unfold[join whitespace-continued values]' \
'--parse[set parsing options]' \
"--no-divider[don't treat --- as the end of the commit message]" \
- '--trailer[specify trailer(s) to add]' \
+ '*--trailer=[apply custom trailer]:trailer:__git_trailers_tokens' \
'*:file:_files'
}
@@ -1293,6 +1319,7 @@ _git-merge () {
$merge_options \
\*{-m+,--message=}'[set the commit message to be used for the merge commit]:merge message' \
\*{-F+,--file=}'[read commit message from a file]:file' \
+ '--into-name=[use specified name instead of the real target]:branch name:__git_branch_names' \
'(--edit --no-edit)-e[open an editor to change the commit message]' \
'( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \
'(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \
@@ -1332,6 +1359,7 @@ _git-mv () {
(( $+functions[_git-notes] )) ||
_git-notes () {
local curcontext=$curcontext state line ret=1
+ local -a args
declare -A opt_args
_arguments -C $endopt \
@@ -1369,12 +1397,18 @@ _git-notes () {
(add)
# TODO: Only complete commits that don't have notes already, unless
# -f or --force has been given.
- _arguments -S -s $endopt \
+ args=( '(-f --force)'{-f,--force}'[overwrite existing note]' )
+ ;&
+ (append)
+ _arguments -S -s $endopt $args \
'*'{-m+,--message=}'[use given note message]:message' \
'*'{-F+,--file=}'[take note message from given file]:note message file:_files' \
'(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \
'(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \
- '(-f --force)'{-f,--force}'[overwrite existing note]' \
+ '--allow-empty[allow storing empty note]' \
+ '(--no-separator)--separator=-[insert text between paragraphs]::paragraph break' \
+ '(--separator)--no-separator' \
+ '--stripspace[remove unnecessary whitespace]' \
': :__git_commits' && ret=0
;;
(copy)
@@ -1405,14 +1439,6 @@ _git-notes () {
(remove)
_arguments -S $endopt --ignore-missing --stdin ':object:__git_commits' && ret=0
;;
- (append)
- _arguments -S -s $endopt \
- '*'{-m+,--message=}'[use given note message]:message' \
- '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \
- '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \
- '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \
- ': :__git_commits' && ret=0
- ;;
(get-ref)
_nothing
;;
@@ -1461,14 +1487,22 @@ _git-push () {
# only complete files on the local end, not the remote end. Still, it may be
# helpful to get some sort of completion going, perhaps modifying the path
# later on to match the remote end.
+
+ local ref_arg
+ if (( words[(I)-d|--delete] )); then
+ ref_arg='*: :__git_remote_branch_names_noprefix'
+ else
+ ref_arg='*: :__git_ref_specs_pushy'
+ fi
+
_arguments -S -s $endopt \
- '--all[push all refs under refs/heads/]' \
+ '(* --all --branches --mirror --tags)'{--all,--branches}'[push all branches]' \
'--prune[remove remote branches that do not have a local counterpart]' \
- '--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \
+ '(* --all --branches --tags)--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \
'(-n --dry-run)'{-n,--dry-run}'[do everything except actually send the updates]' \
'--porcelain[produce machine-readable output]' \
'(-d --delete)'{-d,--delete}'[delete all listed refs from the remote repository]' \
- '--tags[all tags under refs/tags are pushed]' \
+ '(* --all --branches --mirror)--tags[all tags under refs/tags are pushed]' \
'--follow-tags[also push missing annotated tags reachable from the pushed refs]' \
'(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \
'(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \
@@ -1496,7 +1530,7 @@ _git-push () {
'(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
'(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
': :__git_any_repositories' \
- '*: :__git_ref_specs_pushy' && ret=0
+ $ref_arg && ret=0
case $state in
(lease)
@@ -1531,14 +1565,6 @@ _git-range-diff () {
(( $+functions[_git-rebase] )) ||
_git-rebase () {
- local -a autosquash_opts
-
- if (( words[(I)-i|--interactive] )); then
- autosquash_opts=(
- '( --no-autosquash)--autosquash[check for auto-squash boundaries]'
- '(--autosquash )--no-autosquash[do not check for auto-squash boundaries]')
- fi
-
_arguments -s -S $endopt \
- actions \
'(-)--continue[continue after resolving merge conflict]' \
@@ -1565,13 +1591,14 @@ _git-rebase () {
'(-m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--apply[use apply strategies to rebase]' \
'(-m --merge --apply --whitespace -C)'{-m,--merge}'[use merging strategies to rebase]' \
'(-i --interactive --ignore-whitespace --apply --whitespace -C --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \
- '(--apply --whitespace -C)--empty=[specify how to handle commits that become empty]:handling:(drop keep ask)' \
+ '(--apply --whitespace -C)--empty=[specify how to handle commits that become empty]:handling:(drop keep stop)' \
'(--apply --whitespace -C)'{-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \
'(-r --rebase-merges --apply --whitespace -C)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \
'(--apply --whitespace -C)*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
'(--apply --whitespace -C)*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
'(1 --keep-base --fork-point)--root[rebase all reachable commits]' \
- $autosquash_opts \
+ '(--no-autosquash)--autosquash[check for auto-squash boundaries]' \
+ "(--autosquash)--no-autosquash[don't check for auto-squash boundaries]" \
'(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \
"(--autostash --no-autostash)--no-autostash[don't stash uncommitted changes before rebasing and apply them afterwards]" \
'(--root)--fork-point[use merge-base --fork-point to refine upstream]' \
@@ -1580,6 +1607,8 @@ _git-rebase () {
'(--keep-base)--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \
"(--apply --whitespace -C)--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \
'(--apply --whitespace -C)--reapply-cherry-picks[apply all changes, even those already present upstream]' \
+ '--update-refs[update branches that point to commits that are being rebased]' \
+ '!(--update-refs)--no-update-refs' \
':upstream branch:__git_revisions' \
'::working branch:__git_revisions'
}
@@ -1599,6 +1628,7 @@ _git-reset () {
'--recurse-submodules=-[control recursive updating of submodules]::reset:__git_commits' \
'(-p --patch)'{-p,--patch}'[select diff hunks to remove from the index]' \
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
+ '--no-refresh[skip refreshing the index after reset]' \
'(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
'(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'(--soft --mixed --hard --merge --keep):: :__git_commits' \
@@ -1638,7 +1668,7 @@ _git-restore() {
'(-q --quiet --progress)--no-progress[suppress progress reporting]' \
'(--no-progress)--progress[force progress reporting]' \
'(-m --merge)'{-m,--merge}'[perform a 3-way merge with the new branch]' \
- '--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3)' \
+ '--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3 zdiff3)' \
'(-2 --ours -3 --theirs -m --merge)'{-2,--ours}'[checkout our version for unmerged files]' \
'(-2 --ours -3 --theirs -m --merge)'{-3,--theirs}'[checkout their version for unmerged files]' \
'(-p --patch)'{-p,--patch}'[select hunks interactively]' \
@@ -1690,6 +1720,7 @@ _git-revert () {
'*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
+ "--reference[use the 'reference' format to refer to commits in log message]" \
': :__git_recent_commits'
}
@@ -1725,7 +1756,7 @@ _git-shortlog () {
declare -A opt_args
local -a revision_options
- __git_setup_revision_options
+ __git_setup_revision_options -d
# TODO: should take all arguments found in setup_revisions() (probably more
# or less what git-rev-list takes).
@@ -1737,7 +1768,7 @@ _git-shortlog () {
'-w-[linewrap the output]:: :->wrap' \
'*--group=[group commits by field]: : _values -S\: field author committer trailer\:trailer' \
'(-c --committer)'{-c,--committer}'[alias for --group=committer]' \
- $revision_options \
+ ${revision_options:#\*--committer*} \
'(-)--[start file arguments]' \
'*:: :->commit-range-or-file' && ret=0
@@ -1832,6 +1863,7 @@ _git-sparse-checkout() {
add:'update the sparse-checkout file to include additional patterns'
reapply:'reapply the sparsity pattern rules to paths in the working tree'
disable:'disable the config setting, and restore all files in the working directory'
+ check-rules:'check whether sparsity rules match one or more paths'
)
_describe -t commands command commands && ret=0
@@ -1842,13 +1874,22 @@ _git-sparse-checkout() {
init)
_arguments \
'--cone[allow for better performance with a limited set of patterns]' \
- '--no-sparse-index[rewrite index to not be sparse]'
+ '--no-sparse-index[rewrite index to not be sparse]' && ret=0
;;
set|add)
_arguments -S \
- '--stdin[read patterns from input]' \
+ '--cone[initialize the sparse-checkout in cone mode]' \
+ '--sparse-index[toggle the use of a sparse index]' \
+ '--skip-checks[skip some sanity checks on the given paths that might give false positives]' \
+ '(*)--stdin[read patterns from input]' \
'*:pattern:_files' && ret=0
;;
+ check-rules)
+ _arguments \
+ '-z[terminate input and output files by a NUL character]' \
+ '--cone[interpret rules file patterns as cone mode patterns]' \
+ '--rules-file=[use patterns in specified file]:file:_files' && ret=0
+ ;;
esac
;;
esac
@@ -1867,10 +1908,11 @@ _git-stash () {
'(-k --keep-index --no-keep-index)'{-k,--keep-index}'[all changes already added to the index are left intact]'
'(-k --keep-index)--no-keep-index[all changes already added to the index are undone]'
'(-q --quiet)'{-q,--quiet}'[suppress all output]'
- '(-p --patch -a --all -u --include-untracked)'{-u,--include-untracked}'[include untracked files]'
- '(-p --patch -a --all -u --include-untracked)'{-a,--all}'[include ignored files]'
+ '(-p --patch -a --all -u --include-untracked -S --staged)'{-u,--include-untracked}'[include untracked files]'
+ '(-p --patch -a --all -u --include-untracked -S --staged)'{-a,--all}'[include ignored files]'
'(* -p --patch)--pathspec-from-file=[read pathspec from file]:file:_files'
'(* -p --patch)--pathspec-file-nul[pathspec elements are separated with NUL character]'
+ '(-S --staged -a --all -u --include-untracked)'{-S,--staged}'[only stash changes that are currently staged]'
)
_arguments -C \
@@ -1892,6 +1934,7 @@ _git-stash () {
clear:'remove all the stashed states'
drop:'remove a single stashed state from the stash list'
create:'create a stash without storing it in the ref namespace'
+ store:'store a stash created with git stash create in the stash ref'
)
_describe -t commands command commands && ret=0
@@ -1928,7 +1971,9 @@ _git-stash () {
__git_setup_diff_options
_arguments -S -s $endopt \
- $diff_options \
+ ${diff_options:#*\)-u*} \
+ '(-u --include-untracked --only-untracked)'{-u,--include-untracked}'[show the untracked files in the stash entry as part of the diff]' \
+ '(-u --include-untracked)--only-untracked[show only the untracked files in the stash entry as part of the diff]' \
':: :__git_stashes' && ret=0
;;
(pop|apply)
@@ -1950,9 +1995,14 @@ _git-stash () {
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
':: :__git_stashes' && ret=0
;;
+ (store)
+ _arguments -S -s $endopt \
+ '(-m --message)'{-m+,--message=}'[specify stash description]:description' \
+ '(-q --quiet)'{-q,--quiet}'[suppress all output]' && ret=0
+ ;;
(create)
- _nothing
- ;;
+ _message -e messages message
+ ;;
(*)
_nothing
;;
@@ -2056,7 +2106,6 @@ _git-submodule () {
'*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
;;
(update)
- # TODO: --init not properly documented.
_arguments -S \
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
'(-N --no-fetch)'{-N,--no-fetch}'[do not fetch new objects from repository]' \
@@ -2070,6 +2119,7 @@ _git-submodule () {
'--force[discard local changes by checking out the current up-to-date version]' \
'--init[initialize uninitialized submodules]' \
'--single-branch[clone only one branch]' \
+ '--filter=[apply partial clone filter to the submodule]:filter' \
'*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
;;
(set-branch)
@@ -2141,7 +2191,7 @@ _git-subtree () {
_arguments -C \
'(-q --quiet)'{-q,--quiet}'[suppress progress output]' \
'(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \
- '-d[show debug messages]' \
+ '(-d --debug)'{-d,--debug}'[show debug messages]' \
': :->command' \
'*::: := ->option-or-argument' && ret=0
@@ -2238,13 +2288,14 @@ _git-switch() {
'(-q --quiet --progress)--no-progress[suppress progress reporting]' \
'--progress[force progress reporting]' \
'(-m --merge --discard-changes --orphan)'{-m,--merge}'[perform a 3-way merge with the new branch]' \
- '(--discard-changes --orphan)--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3)' \
+ '(--discard-changes --orphan)--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3 zdiff3)' \
'(-d --detach -c --create -C --force-create --ignore-other-worktrees --orphan --guess --no-guess 1)'{-d,--detach}'[detach HEAD at named commit]' \
- '(-t --track --no-track --guess --orphan 1)'{-t,--track}'[set upstream info for new branch]' \
+ '(--track --no-track --guess --orphan 1)-t[set upstream info for new branch]' \
+ '(-t --no-track --guess --orphan 1)--track=-[set upstream info for new branch]::configuration:(direct inherit)' \
"(-t --track --guess --orphan 1)--no-track[don't set upstream info for a new branch]" \
'(-c --create -C --force-create -d --detach --ignore-other-worktrees -m --merge --conflict -t --track --guess --no-track -t --track)--orphan[create new unparented branch]: :__git_branch_names' \
'!--overwrite-ignore' \
- "(-c --create -C --force-create -d --detach --orphan)--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \
+ "(-c --create -C --force-create -d --detach --orphan)--ignore-other-worktrees[don't check if another worktree is using this branch]" \
'1: :->branches' \
'2:start point:->start-points' && ret=0
@@ -2287,6 +2338,7 @@ _git-tag () {
'--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' \
'(-m --message -F --file)'{-F+,--file=}'[read tag message from given file]:message file:_files' \
'(-m --message -F --file)'{-m+,--message=}'[specify tag message]:message' \
+ '*--trailer=[add custom trailer]:trailer:__git_trailers_tokens' \
': :__git_tags' \
':: :__git_commits' \
- deletion \
@@ -2301,6 +2353,7 @@ _git-tag () {
"*--no-contains=[only list tags that don't contain the specified commit]: :__git_commits" \
'--merged=-[print only tags that are merged]:: :__git_commits' \
'--no-merged=-[print only tags that are not merged]:: :__git_commits' \
+ "--omit-empty[don't output a newline after empty formatted refs]" \
'--sort=[specify how the tags should be sorted]:field:__git_ref_sort_keys' \
'--points-at=[only list tags of the given object]: :__git_commits' \
'--format=[specify format to use for the output]:format:__git_format_ref' \
@@ -2332,6 +2385,7 @@ _git-worktree() {
lock:'prevent a working tree from being pruned'
move:'move a working tree to a new location'
remove:'remove a working tree'
+ repair:'repair worktree administrative files'
unlock:'allow working tree to be pruned, moved or deleted'
)
@@ -2346,23 +2400,34 @@ _git-worktree() {
else
args=( ':commit:__git_commits' )
fi
- _arguments -S $endopt \
+ _arguments -s -S $endopt \
'(-f --force)'{-f,--force}'[checkout branch even if already checked out in another worktree]' \
- '(-B --detach)-b+[create a new branch]: :__git_branch_names' \
- '(-b --detach)-B+[create or reset a branch]: :__git_branch_names' \
- '(-b -B)--detach[detach HEAD at named commit]' \
+ '(-B -d --detach --guess-remote)-b+[create a new branch]: :__git_branch_names' \
+ '(-b -d --detach --guess-remote)-B+[create or reset a branch]: :__git_branch_names' \
+ '(-b -d --detach)--orphan[create unborn/orphaned branch]' \
+ '(-d --detach -b -B --orphan --guess-remote --track --no-track)'{-d,--detach}'[detach HEAD at named commit]' \
'--no-checkout[suppress file checkout in new worktree]' \
'--lock[keep working tree locked after creation]' \
+ '--reason=[specify reason for locking]:reason' \
+ '(2 --no-guess-remote -b -B -d --detach)--guess-remote[guess remote tracking branch from path basename]' \
+ "(--guess-remote)--no-guess-remote[don't guess remote tracking branch from path basename]" \
+ '(--no-track -d --detach)--track[set upstream info for new branch]' \
+ "(--track -d --detach)--no-track[don't set upstream info for new branch]" \
+ '(-q --quiet)'{-q,--quiet}'[suppress feedback messages]' \
':path:_directories' $args && ret=0
;;
(prune)
- _arguments -S $endopt \
+ _arguments -s -S $endopt \
'(-n --dry-run)'{-n,--dry-run}"[don't remove, show only]" \
'(-v --verbose)'{-v,--verbose}'[report pruned objects]' \
- '--expire[expire objects older than specified time]:time' && ret=0
+ '--expire=[expire objects older than specified time]: :_git_approxidates' && ret=0
;;
(list)
- _arguments -S $endopt '--porcelain[machine-readable output]' && ret=0
+ _arguments -S $endopt \
+ '(-v --verbose --porcelain -z)'{-v,--verbose}'[output additional information about worktrees]' \
+ "--expire=[add 'prunable' annotation to worktrees older than specified time]: :_git_approxidates" \
+ '(-v)--porcelain[machine-readable output]' \
+ '(-v)-z[terminate each line with a NUL rather than a newline]' && ret=0
;;
(lock)
_arguments -C -S $endopt '--reason=[specify reason for locking]:reason' ': :->worktrees' && ret=0
@@ -2373,9 +2438,13 @@ _git-worktree() {
':location:_directories' && ret=0
;;
(remove)
- _arguments -C -S $endopt '--force[remove working trees that are not clean or that have submodules]' \
+ _arguments -C -S $endopt \
+ '(-f --force)'{-f,--force}'[remove working trees that are not clean or that have submodules]' \
': :->worktrees' && ret=0
;;
+ (repair)
+ _directories && ret=0
+ ;;
(unlock)
state=worktrees
;;
@@ -2448,6 +2517,7 @@ _git-config () {
'(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-scope)--show-origin[show origin of config]' \
'(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-origin)--show-scope[show scope of config (worktree, local, global, system, command)]' \
'(2 --add -e --edit -l --list --name-only --rename-section --remove-section --replace-all --unset --unset-all)--default=[with --get, use specified default value when entry is missing]:default' \
+ '--comment=[specify human-readable comment string]:comment' \
$name_arg \
$value_arg \
'::value regex' \
@@ -2528,6 +2598,7 @@ __git_config_option-or-value () {
advice.ignoredHook:'show advice if a hook is ignored because the hook is not set as executable::->bool:true'
advice.waitingForEditor:'print a message to the terminal whenever Git is waiting for editor input from the user::->bool:true'
advice.nestedTag:'show advice if a user attempts to recursively tag a tag object::->bool:true'
+ attr.tree:'reference to tree in repository from which to read attributes:ref:->string'
author.email:'email address used for author in commits::_email_addresses -c'
author.name:'full name used for author in commits:name:->string'
am.threeWay:'use 3-way merge if patch does not apply cleanly::->bool:false'
@@ -2564,6 +2635,7 @@ __git_config_option-or-value () {
core.symlinks:'create symbolic links for indexed symbolic links upon creation::->bool:true'
core.gitProxy:'command to execute to establish a connection to remote server:proxy command:_cmdstring'
core.ignoreStat:'ignore modification times of files::->bool:false'
+ core.maxTreeDepth:'maximum depth Git should recurse while traversing a tree'
core.preferSymlinkRefs:'use symbolic links for symbolic-reference files::->bool:false'
core.bare:'use a repository without a working tree::->bool:false'
core.worktree:'path to the root of the work tree:work tree:_directories'
@@ -2572,7 +2644,7 @@ __git_config_option-or-value () {
core.sharedRepository:'what kind of sharing is done for this repository::->permission:false'
core.warnAmbiguousRefs:'warn if a ref name is ambiguous::->bool:true'
core.compression:'level of compression to apply to packs::->compression:-1'
- core.loosecompression:'level of compression to apply to non-pack files::->compression:1'
+ core.looseCompression:'level of compression to apply to non-pack files::->compression:1'
core.packedGitWindowSize:'size of mappings of pack files:pack window size:->bytes'
core.packedGitLimit:'maximum number of bytes to map from pack files:maximum pack file map size:->bytes'
core.packedRefsTimeout:"how long to retry locking the packed-refs file:retry time (milliseconds, or -1 for indefinite):->int:1000"
@@ -2693,6 +2765,7 @@ __git_config_option-or-value () {
diff.renameLimit:'number of files to consider when detecting copy/renames:limit (number of files):->int'
diff.renames:'try to detect renames::->diff.renames:true'
diff.ignoreSubmodules:'ignore submodules::->bool:false'
+ diff.statNameWidth:'limit on width of filename part in --stat output:width:->int'
diff.statGraphWidth:'width of the graph part in --stat output:width:->int'
diff.submodule:'output format for submodule differences::->diff.submodule:short'
diff.suppressBlankEmpty:'inhibit printing space before empty output lines::->bool:false'
@@ -2731,16 +2804,23 @@ __git_config_option-or-value () {
format.signoff:'enable --signoff by default::->bool:false'
'gc.*.reflogexpire:grace period for git reflog expire::->days:90'
'gc.*.reflogexpireunreachable:grace period for git reflog expire for unreachable entries::->days:30'
+ fsck.hasDot:'warn if a tree contains an entry named ..::->bool:false'
+ fsck.hasDotdot:'warn if a tree contains an entry named ...::->bool:false'
+ fsck.hasDotgit:'warn if a tree contains an entry named .git::->bool:false'
+ fsck.largePathname:'warn on long path names::->int:4096'
gc.aggressiveDepth:'maximum delta depth:maximum delta depth::->int:250'
gc.aggressiveWindow:'window size used in delta compression algorithm::->int:250'
gc.auto:'minimum limit for packing loose objects with --auto::->int:6700'
gc.autoDetach:"make 'git gc --auto' run in the background::->bool:true"
gc.autopacklimit:'minimum limit for packing packs with --auto::->int:50'
gc.bigPackThreshold:"keep large packs:size threshold:->bytes"
+ gc.maxCruftSize:'limit size of new cruft packs when repacking:size:->int'
gc.packrefs:'allow git gc to run git pack-refs::->gc.packrefs:true'
gc.pruneexpire:'grace period for pruning:number of days, "now", or "never":->int'
gc.reflogexpire:'grace period for git reflog expire::->days:90'
gc.reflogexpireunreachable:'grace period for git reflog expire for unreachable entries::->days:30'
+ gc.repackFilter:'when repacking, use the specified filter to move certain objects into a separate packfile:filter:_git_rev-list_filters'
+ gc.repackFilterTo:'when repacking, pack prefix to store a pack containing filtered out objects:directory:_directories'
gc.rerereresolved:'number of days to keep records of resolved merges::->days:60'
gc.rerereunresolved:'number of days to keep records of unresolved merges::->days:15'
gc.worktreePruneExpire:'grace period for pruning worktrees:number of days, "now", or "never":->int' # git default: 3.months.ago
@@ -2932,6 +3012,7 @@ __git_config_option-or-value () {
rebase.autoSquash:'autosquash by default::->bool:false'
rebase.autoStash:'autostash by default::->bool:false'
rebase.instructionFormat:'interactive rebase todo list format::__git_format_placeholders'
+ rebase.maxLabelLength:'when generating label names from commit subjects, length to truncate the names to:length:->int'
rebase.missingCommitsCheck:'print a warning if some commits are removed'
rebase.rescheduleFailedExec:"automatically re-schedule any 'exec' that fails::->bool"
receive.autogc:'run git gc --auto after receiving data::->bool:true'
@@ -2942,6 +3023,7 @@ __git_config_option-or-value () {
receive.denyDeleteCurrent:'deny a ref update that deletes currently checked out branch::->bool:false'
receive.denyCurrentBranch:'deny a ref update of currently checked out branch::->receive.denyCurrentBranch'
receive.denyNonFastForwards:'deny a ref update that is not a fast-forward::->bool:false'
+ receive.fsck.largePathname:'warn on long path names::->int:4096'
receive.updateserverinfo:'run git update-server-info after receiving data::->bool:false'
'remote.pushdefault:URL of a remote repository to pushto::__git_any_repositories'
'remote.*.url:URL of a remote repository::__git_any_repositories'
@@ -3829,7 +3911,12 @@ _git-pack-refs () {
'( --no-all)--all[pack all refs]' \
'(--all )--no-all[do not pack all refs]' \
'( --no-prune)--prune[remove loose refs after packing them]' \
- '(--prune )--no-prune[do not remove loose refs after packing them]'
+ '(--prune )--no-prune[do not remove loose refs after packing them]' \
+ '--auto[auto-pack refs as needed]' \
+ '*--include=[references to include]:reference pattern:_git_full_references' \
+ '*--exclude=[references to exclude]:reference pattern:_git_full_references' \
+ '--no-include[clear and reset the list of include patterns]' \
+ '--no-exclude[clear and reset the list of exclude patterns]'
}
(( $+functions[_git-prune] )) ||
@@ -3838,7 +3925,7 @@ _git-prune () {
'(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \
'(-v --verbose)'{-v,--verbose}'[report all removed objects]' \
'--progress[show progress]' \
- '--expire=[only expire loose objects older than specified date]: :__git_datetimes' \
+ '--expire=[only expire loose objects older than specified date]: :_git_approxidates' \
'--exclude-promisor-objects[limit traversal to objects outside promisor packfiles]' \
'*:: :__git_heads'
}
@@ -3870,6 +3957,7 @@ _git-reflog () {
commands=(
'expire:prune old reflog entries'
'delete:delete entries from reflog'
+ 'list:list all refs that have a corresponding reflog'
'show:show log of ref'
'exists:check whether a ref has a reflog'
)
@@ -3886,8 +3974,8 @@ _git-reflog () {
_arguments -S \
'(-n --dry-run)'{-n,--dry-run}"[don't actually prune any entries; show what would be pruned]" \
'--stale-fix[prune any reflog entries that point to "broken commits"]' \
- '--expire=-[prune entries older than given time]: :__git_datetimes' \
- '--expire-unreachable=-[prune entries older than given time and unreachable]: :__git_datetimes' \
+ '--expire=-[prune entries older than given time]:age [90 days]:_git_approxidates' \
+ '--expire-unreachable=-[prune entries older than given time and unreachable]:age [30 days]:_git_approxidates' \
'--all[prune all refs]' \
'--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \
'--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \
@@ -3895,7 +3983,7 @@ _git-reflog () {
;;
(delete)
_arguments -C -S \
- '(-n --dry-run)'{-n,--dry-run}"[dpn't update entries; show what would be done]" \
+ '(-n --dry-run)'{-n,--dry-run}"[don't update entries; show what would be done]" \
'--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \
'--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \
'--verbose[output additional information]' \
@@ -3923,6 +4011,48 @@ _git-reflog () {
fi
}
+(( $+functions[_git-refs] )) ||
+_git-refs() {
+ local curcontext=$curcontext state line ret=1
+ declare -A opt_args
+
+ _arguments -C \
+ ': :->command' \
+ '*:: :->option-or-argument' && ret=0
+
+ case $state in
+ (command)
+ declare -a commands
+
+ commands=(
+ 'migrate:migrate ref store between different formats'
+ 'verify:verify reference database consistency'
+ )
+
+ _describe -t commands command commands && ret=0
+ ;;
+ (option-or-argument)
+ curcontext=${curcontext%:*}-$line[1]:
+
+ case $line[1] in
+ migrate)
+ _arguments -S -s $endopt \
+ '--ref-format=[specify ref format to migrate the ref store to]:ref format:(files reftable)' \
+ "--dry-run[perform the migration, but don't modify the repository]" && ret=0
+ ;;
+ verify)
+ _arguments -S -s $endopt \
+ '--strict[enable stricter error checking]' \
+ '--verbose[when verifying the reference database consistency, be chatty]' && ret=0
+ ;;
+ *) _default && ret=0 ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
(( $+functions[_git-remote] )) ||
_git-remote () {
local curcontext=$curcontext state line ret=1
@@ -3975,7 +4105,9 @@ _git-remote () {
': :__git_remotes' && ret=0
;;
(rename)
- _arguments \
+ _arguments -S $endopt \
+ '(--no-progress)--progress' \
+ '(--progress)--no-progress' \
':old name:__git_remotes' \
':new name:__git_remotes' && ret=0
;;
@@ -4033,8 +4165,11 @@ _git-repack () {
_arguments -s \
'(-A --unpack-unreachable)-a[pack all objects into a single pack]' \
'(-a -k --keep-unreachable)-A[pack all objects into a single pack, but unreachable objects become loose]' \
+ '--cruft[pack unreachable cruft objects separately]' \
+ '--cruft-expiration=[expire cruft objects older than specified time]: :_git_approxidates' \
+ '--max-cruft-size=[with --cruft, limit the size of new cruft packs]: : __git_guard_bytes "maximum cruft size"' \
'-d[remove redundant packs after packing]' \
- "--unpack-unreachable=[with -A, don't loosen objects older than specified date]:date" \
+ "--unpack-unreachable=[with -A, don't loosen objects older than specified date]: :_git_approxidates" \
'-f[pass --no-reuse-delta option to git pack-objects]' \
'-F[pass --no-reuse-object option to git pack-objects]' \
"-n[don't update server information]" \
@@ -4042,17 +4177,20 @@ _git-repack () {
'(-l --local)'{-l,--local}'[pass --local option to git pack-objects]' \
'(-b --write-bitmap-index)'{-b,--write-bitmap-index}'[write a bitmap index]' \
'(-i --delta-islands)'{-i,--delta-islands}'[pass --delta-islands to git-pack-objects]' \
- "--unpack-unreachable=[with -A, don't loosen objects older than specified time]:time" \
+ "--unpack-unreachable=[with -A, don't loosen objects older than specified time]: :_git_approxidates" \
'(-k --keep-unreachable)'{-k,--keep-unreachable}'[with -a, repack unreachable objects]' \
'--window=[number of objects to consider when doing delta compression]:number of objects' \
'--window-memory=[scale window size dynamically to not use more than specified amount of memory]: : __git_guard_bytes' \
'--depth=[maximum delta depth]:maximum delta depth' \
'--threads=[limit maximum number of threads]:threads' \
'--max-pack-size=-[maximum size of each output packfile]: : __git_guard_bytes "maximum pack size"' \
+ '--filter=[object filtering]:filter:_git_rev-list_filters' \
'--pack-kept-objects[repack objects in packs marked with .keep]' \
'--keep-pack=[ignore named pack]:pack' \
'(-g --geometric)'{-g+,--geometric=}'[find a geometric progression with specified factor]:factor' \
- '(-m --write-midx)'{-m,--write-midx}'[write a multi-pack index of the resulting packs]'
+ '(-m --write-midx)'{-m,--write-midx}'[write a multi-pack index of the resulting packs]' \
+ '--expire-to=[pack prefix to store a pack containing pruned objects]:directory:_directories' \
+ '--filter-to=[pack prefix to store a pack containing filtered out objects]:directory:_directories'
}
(( $+functions[_git-replace] )) ||
@@ -4085,7 +4223,7 @@ _git-blame () {
declare -A opt_args
declare -a revision_options
- __git_setup_revision_options
+ __git_setup_revision_options -d
# TODO: Not sure about __git_cached_files.
_arguments -C -S -s $endopt \
@@ -4128,7 +4266,8 @@ _git-blame () {
else
_alternative \
'line-numbers: :__git_guard_number "line number"' \
- 'regexes::_guard "(/[^/]#(\\?[^/]#)#(/|)|)" regex' && ret=0
+ 'regexes::_guard "(/[^/]#(\\?[^/]#)#(/|)|)" regex' \
+ 'functions::_guard "(|:*)" "function name"' && ret=0
fi
;;
esac
@@ -4139,8 +4278,9 @@ _git-blame () {
(( $+functions[_git-bugreport] )) ||
_git-bugreport() {
_arguments \
- '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the bugreport file]:directory:_directories' \
- '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format suffix for the filename]:format:_date_formats'
+ '--diagnose=-[create an additional zip archive of detailed diagnostics]::mode [stats]:(stats all)' \
+ '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the bugreport]:directory:_directories' \
+ '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format filename suffix]:format:_date_formats'
}
(( $+functions[_git-cherry] )) ||
@@ -4160,6 +4300,14 @@ _git-count-objects () {
{-H,--human-readable}'[print sizes in human readable format]'
}
+(( $+functions[_git-diagnose] )) ||
+_git-diagnose() {
+ _arguments -S $endopt \
+ '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the diagnostics archive]:destination:_directories' \
+ '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format suffix for the filename]:format:_date_formats' \
+ '--mode=[specify the content of the diagnostic archive]:content [stats]:(stats all)'
+}
+
(( $+functions[_git-difftool] )) ||
_git-difftool () {
# TODO: Is this fine, or do we need to modify the context or similar?
@@ -4189,9 +4337,10 @@ _git-fsck () {
'--full[check all object directories]' \
'--connectivity-only[check only connectivity]' \
'--strict[do strict checking]' \
- '(-v --verbose)'{-v,--verbose}'[output additional information]' \
+ '(-v --verbose --no-progress)'{-v,--verbose}'[output additional information]' \
'--lost-found[write dangling objects into .git/lost-found]' \
- '--progress[show progress]' \
+ "(-v --verbose)--no-progress[don't show progress]" \
+ '!(-v --verbose --no-progress)--progress' \
'--name-objects[show verbose names for reachable objects]' \
'*: :__git_objects'
}
@@ -4204,14 +4353,19 @@ _git-get-tar-commit-id () {
(( $+functions[_git-help] )) ||
_git-help () {
_arguments -S -s \
- '(-c --config -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
+ '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
+ '(-g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man -w --web)--no-external-commands[exclude external commands, with --all]' \
+ '(-g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man -w --web)--no-aliases[exclude aliases, with --all]' \
+ '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \
+ '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \
+ '(-a --all -g --guides --user-interfaces --developer-interfaces -c --config -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \
+ '!(--no-verbose)'{-v,--verbose} \
+ "--no-verbose[don't print command descriptions]" \
+ '(-)'{-g,--guides}'[print list of useful guides]' \
+ '(-)--user-interfaces[print list of user-facing repository, command and file interfaces]' \
+ '(-)--developer-interfaces[print list of file formats, protocols and other developer interfaces]' \
'(-)'{-c,--config}'[print all configuration variable names]' \
- '(-a --all -g --guides -c --config -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \
- '(-a --all -g --guides -c --config -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \
- '(-a --all -g --guides -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \
- '(-g --guides -c --config -i --info -m --man -w --web)'{-g,--guides}'[prints a list of useful guides on the standard output]' \
- '(-v --verbose)'{-v,--verbose}'[print command descriptions]' \
- ': : _alternative commands:command:_git_commands "guides:git guide:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"'
+ ': : _alternative commands:command:_git_commands "guides:git guide:_git_help_guides"'
}
(( $+functions[_git-instaweb] )) ||
@@ -4248,7 +4402,17 @@ _git-instaweb () {
(( $+functions[_git-merge-tree] )) ||
_git-merge-tree () {
- _arguments \
+ _arguments -S $endopt \
+ '(1)--write-tree[do a real merge instead of a trivial merge]' \
+ '(-)--trivial-merge[do a trivial merge only]' \
+ '(--no-messages)--messages[also show informational/conflict messages]' \
+ "(--messages)--no-messages[don't show informational/conflict messages]" \
+ '-z[separate paths with the NUL character]' \
+ '--name-only[list filenames without modes/oids/stages]' \
+ '--allow-unrelated-histories[allow merging unrelated histories]' \
+ '--stdin[perform multiple merges, one per line of input]' \
+ '--merge-base=[specify a merge-base for the merge]:commit:__git_commits' \
+ '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
':base-tree:__git_tree_ishs' \
':branch 1:__git_tree_ishs' \
':branch 2:__git_tree_ishs'
@@ -4261,14 +4425,14 @@ _git-rerere () {
_arguments -C -S -s $endopt \
'--rerere-autoupdate[register clean resolutions in index]' \
- ': :->command' && ret=0
+ ': :->command' \
+ '*: :{ [[ $words[CURRENT-1] = forget ]] && __git_cached_files }' && ret=0
case $state in
(command)
- # TODO: This isn't optimal, as forget get confused.
_values command \
'clear[reset metadata used by rerere]' \
- 'forget[resets metadata used by rerere for specific conflict]: :__git_cached_files' \
+ 'forget[resets metadata used by rerere for specific conflict]' \
'diff[output diffs for the current state of the resolution]' \
'status[print paths with conflicts whose merge resolution rerere will record]' \
'remaining[print paths with conflicts that have not been autoresolved by rerere]' \
@@ -4344,8 +4508,8 @@ _git-rev-parse () {
'--is-inside-work-tree[show whether or not current working directory is inside work tree]' \
'--is-bare-repository[show whether or not repository is bare]' \
'(--revs-only --no-revs --flags --no-flags --verify)--short=-[show only shorter unique name]:: :__git_guard_number length' \
- '(--since --after)'{--since=-,--after=-}'[show --max-age= parameter corresponding given date string]:datestring' \
- '(--until --before)'{--until=-,--before=-}'[show --min-age= parameter corresponding given date string]:datestring' \
+ '(--since --after)'{--since=-,--after=-}'[show --max-age= parameter corresponding given date string]: :_git_approxidates' \
+ '(--until --before)'{--until=-,--before=-}'[show --min-age= parameter corresponding given date string]: :_git_approxidates' \
'--resolve-git-dir[check if <path> is a valid repository or gitfile and print location]:git dir:_files -/' \
'*: :__git_objects' && ret=0
fi
@@ -4385,7 +4549,7 @@ _git-show-branch () {
if compset -P '[[:digit:]]##,'; then
_alternative \
'counts: :__git_guard_number count' \
- 'dates::__git_datetimes' && ret=0
+ 'dates::_git_approxidates' && ret=0
else
__git_guard_number limit
fi
@@ -4547,6 +4711,7 @@ _git-send-email () {
'--8bit-encoding=[encoding to use for non-ASCII messages]: :__git_encodings' \
'--compose-encoding=[encoding to use for compose messages]: :__git_encodings' \
'--transfer-encoding=[specify transfer encoding to use]:transfer encoding:(quoted-printable 8bit base64)' \
+ '--mailmap[use mailmap file to map email addresses to canonical real names and addresses]' \
'--envelope-sender=[specify the envelope sender used to send the emails]: :_email_addresses' \
'--sendmail-cmd=[specify command to run to send email]:command:_cmdstring' \
'--smtp-encryption=[specify encryption method to use]: :__git_sendemail_smtpencryption_values' \
@@ -4564,6 +4729,8 @@ _git-send-email () {
'--relogin-delay=[specify delay between successive logins]:delay (seconds)' \
'--cc-cmd=[specify command to generate Cc\: header with]:Cc\: command:_cmdstring' \
'--to-cmd=[specify command to generate To\: header with]:To\: command:_cmdstring' \
+ '--header-cmd=[specify command to generate headers with]:header command:_cmdstring' \
+ '--no-header-cmd[disable any header command in use]' \
'( --no-chain-reply-to)--chain-reply-to[send each email as a reply to previous one]' \
'(--chain-reply-to )--no-chain-reply-to[send all emails after first as replies to first one]' \
'--identity=[specify configuration identity]: :__git_sendemail_identities' \
@@ -4583,6 +4750,7 @@ _git-send-email () {
'(--validate )--no-validate[do not perform sanity checks on patches]' \
'--force[send emails even if safety checks would prevent it]' \
'(- *)--dump-aliases[dump configured aliases and exit]' \
+ '(- *)--translate-aliases[translate aliases from stdin according to alias file]' \
'*: : _alternative -O expl
"files:file:_files"
"commits:recent commit object name:__git_commit_objects_prefer_recent"'
@@ -4891,13 +5059,16 @@ _git-apply () {
_arguments -S -s $endopt \
$apply_options \
- '(--index --cached --reject)'{-3,--3way}'[fall back on 3-way merge if patch fails]' \
+ '(--index --cached --reject)'{-3,--3way}'[attempt three-way merge, fall back on normal patch if that fails]' \
'--stat[output diffstat for input (turns off "apply")]' \
'--numstat[same as --stat but in decimal notation and complete pathnames (turns off "apply")]' \
'--summary[output summary of git-diff extended headers (turns off "apply")]' \
'--check[check if patches are applicable (turns off "apply")]' \
'( --cached)--index[make sure that patch is applicable to index]' \
'(--index )--cached[apply patches without touching working tree]' \
+ '(--theirs --union)--ours[for conflicts, use our version]' \
+ '(--ours --union)--theirs[for conflicts, use their version]' \
+ '(--theirs --ours)--union[for conflicts, use a union version]' \
'--build-fake-ancestor[build temporary index for blobs with ambiguous origin]:index:_files' \
'(-R --reverse)'{-R,--reverse}'[apply patches in reverse]' \
'-z[use NUL termination on output]' \
@@ -4906,8 +5077,10 @@ _git-apply () {
'--no-add[ignore additions made by the patch]' \
'--allow-overlap[allow overlapping hunks]' \
'--inaccurate-eof[work around missing-new-line-at-EOF bugs]' \
- '(-v --verbose)'{-v,--verbose}'[display progress on stderr]' \
+ '(-v --verbose -q --quiet)'{-v,--verbose}'[display progress on stderr]' \
+ '(-q --quiet -v --verbose)'{-q,--quiet}'[be more quiet]' \
'--recount[do not trust line counts in hunk headers]' \
+ "--allow-empty[don't return error for empty patches]" \
'*:patch:_files'
}
@@ -4924,8 +5097,9 @@ _git-checkout-index () {
'(-q --quiet)'{-q,--quiet}'[no warning for existing files and files not in index]' \
'(-f --force)'{-f,--force}'[force overwrite of existing files]' \
'(-a --all --stdin *)'{-a,--all}'[check out all files in index]' \
- '(-n --no-create)'{-n,--no-create}'[do not checkout new files]' \
+ '(-n --no-create)'{-n,--no-create}"[don't checkout new files]" \
'--temp[write content to temporary files]' \
+ "--ignore-skip-worktree-bits[don't skip files with skip-worktree set]" \
'(-a --all *)--stdin[read list of paths from the standard input]' \
'--prefix=[prefix to use when creating files]:directory:_directories' \
'--stage=[check out files from named stage]:stage:(1 2 3 all)' \
@@ -4947,7 +5121,7 @@ _git-commit-graph() {
'(--reachable --stdin-packs)--stdin-commits[walk commits starting at commits read from input]'
'(--append)--size-multiple=:commits [2]'
'(--append)--max-commits=:commits'
- '(--append)--expire-time=:date/time:__git_datetimes'
+ '(--append)--expire-time=: :_git_approxidates'
'--max-new-filters=[specify maximum number of changed-path bloom filters to compute]:'
)
elif [[ $words[2] = verify ]]; then
@@ -5010,6 +5184,7 @@ _git-index-pack () {
$stdin_opts \
'--strict[die if the pack contains broken objects or links]' \
'--threads=[specify number of threads to use]:number of threads' \
+ '!--fsck-objects' \
':pack file:_files -g "*.pack(-.)"'
}
@@ -5033,8 +5208,15 @@ _git-merge-file () {
'( --theirs --union)--ours[resolve conflicts favoring our side of the lines]' \
'(--ours --union)--theirs[resolve conflicts favoring their side of the lines]' \
'(--ours --theirs )--union[resolve conflicts favoring both sides of the lines]' \
+ '--diff-algorithm=[choose a diff algorithm]:diff algorithm:((default\:"basic greedy diff algorithm"
+ myers\:"basic greedy diff algorithm"
+ minimal\:"spend extra time to make sure the smallest possible diff is produced"
+ patience\:"generate diffs with patience algorithm"
+ histogram\:"generate diffs with histogram algorithm"))' \
'--marker-size[specify length of conflict markers]: :__git_guard_number "marker length"' \
- '--diff3[use a diff3 based merge]' \
+ '--object-id[use object IDs instead of filenames]' \
+ '(--zdiff3)--diff3[show conflicts in "diff3" style]' \
+ '(--diff3)--zdiff3[show conflicts in "zdiff3" style]' \
':current file:_files' \
':base file:_files' \
':other file:_files'
@@ -5116,7 +5298,9 @@ _git-pack-objects () {
'--include-tag[include unasked-for annotated tags if object they reference is included]' \
'(--revs --stdin-packs --unpack-unreachable)--keep-unreachable[add objects unreachable from refs in packs named with --unpacked to resulting pack]' \
'(--revs --stdin-packs)--pack-loose-unreachable[pack unreachable loose objects]' \
- '(--revs --stdin-packs --keep-unreachable)--unpack-unreachable=-[keep unreachable objects in loose form]::time' \
+ '(--revs --stdin-packs --keep-unreachable)--unpack-unreachable=-[keep unreachable objects in loose form]:: :_git_approxidates' \
+ '--cruft[create a cruft pack]' \
+ '--cruft-expiration=[expire cruft objects older than specified time]: :_git_approxidates' \
'--sparse[use sparse reachability algorithm]' \
'--include-tag[include tag objects that refer to objects to be packed]' \
$thin_opt \
@@ -5194,6 +5378,7 @@ _git-symbolic-ref () {
'(-q --quiet)'{-q,--quiet}'[do not issue error if specified name is not a symbolic ref]' \
'--short[shorten the ref name (eg. refs/heads/master -> master)]' \
'-m[update reflog for specified name with specified reason]:reason for update' \
+ '--no-recurse[stop after dereferencing a single level of symbolic ref]' \
':symbolic reference:__git_heads' \
':: :__git_references'
}
@@ -5242,6 +5427,7 @@ _git-update-index () {
'--verbose[report what is being added and removed from the index]' \
'--clear-resolve-undo[forget saved unresolved conflicts]' \
'--index-version=[write index in specified on-disk format version]:version:(2 3 4)' \
+ '--show-index-version[report on-disk index format version]' \
'--split-index[enable/disable split index]' \
'--untracked-cache[enable/disable untracked cache]' \
'--test-untracked-cache[test if the filesystem supports untracked cache]' \
@@ -5289,8 +5475,8 @@ _git-cat-file () {
_arguments -S -s \
'(-t -s -e -p --allow-unknown-type 1)--textconv[show content as transformed by a textconv filter]' \
'(-t -s -e -p --allow-unknown-type 1)--filters[show content as transformed by filters]' \
- '(-t -s -e -p --allow-unknown-type 1)--path=[use a specific path for --textconv/--filters]:path:_directories' \
- query \
+ '(-t -s -e -p --allow-unknown-type 1)--path=[use a specific path for --textconv/--filters]:path:_directories' \
'(-s -e -p --textconv --filters 1)-t[show type of given object]' \
'(-t -e -p --textconv --filters 1)-s[show size of given object]' \
'(-e -p --textconv --filters 1)--allow-unknown-type[allow query of broken/corrupt objects of unknown type]' \
@@ -5299,12 +5485,14 @@ _git-cat-file () {
'(-):object type:(blob commit tag tree)' \
': :__git_objects' \
- batch \
- '(--batch-check)--batch=-[print SHA1, type, size and contents (or in specified format)]::format' \
- '(--batch)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \
+ '(--batch-check --batch-command)--batch=-[print SHA1, type, size and contents (or in specified format)]::format' \
+ '(--batch --batch-command)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \
+ '(--batch-check --batch)--batch-command=-[enter a command mode that reads commands and arguments from stdin]::format' \
'--follow-symlinks[follow in-tree symlinks (used with --batch or --batch-check)]' \
'--batch-all-objects[show all objects with --batch or --batch-check]' \
"--unordered[don't order --batch-all-objects output]" \
- '--buffer[disable flushing of output after each object]'
+ '--buffer[disable flushing of output after each object]' \
+ '-Z[input and output is NUL-delimited instead of newline-delimited]'
}
(( $+functions[_git-diff-files] )) ||
@@ -5332,8 +5520,11 @@ _git-diff-index () {
# to given tree-ish? This should be done for git-diff as well, in that case.
_arguments -S \
$revision_options \
+ '--exit-code[report exit code 1 if differences, 0 otherwise]' \
+ '(--exit-code)--quiet[disable all output]' \
"--cached[don't consider the work tree at all]" \
'-m[flag non-checked-out files as up-to-date]' \
+ '--merge-base[use merge base instead of comparing directly]' \
': :__git_tree_ishs' \
'*: :__git_cached_files'
}
@@ -5350,16 +5541,18 @@ _git-diff-tree () {
# __git_setup_revision_options, but only used by this command, so only have
# them here.
_arguments -C -S -s \
- $revision_options \
+ ${revision_options:#*--cc\[*} \
+ '--exit-code[report exit code 1 if differences, 0 otherwise]' \
+ '(--exit-code)--quiet[disable all output]' \
'-r[recurse into subdirectories]' \
'(-r )-t[display tree objects in diff output]' \
'--root[display root diff]' \
+ '--merge-base[use merge base instead of comparing directly]' \
'-m[do not ignore merges]' \
'-s[do not show differences]' \
'(--pretty --header)-v[display commit message before differences]' \
'--no-commit-id[do not display commit IDs]' \
- '(-c --cc)-c[show differences from each of parents to merge result]' \
- '(-c --cc)--cc[how differences from each of parents and omit differences from only one parent]' \
+ '(-c)--cc[combined diff format for merge commits, further omitting uninteresting hunks]' \
'--combined-all-paths[show name of file in all parents for combined diffs]' \
'--always[always show commit itself and commit log message]' \
': :__git_tree_ishs' \
@@ -5396,27 +5589,32 @@ _git-for-each-ref () {
# is, %(refname), %(objecttype), %(objectsize), %(objectname) with optional '*'
# in front.
_arguments -S -s \
+ "--omit-empty[don't output a newline after empty formatted refs]" \
'--count=[maximum number of refs to iterate over]: :__git_guard_number "maximum number of refs"' \
'*--sort=[key to sort refs by]: :__git_ref_sort_keys' \
'--format=-[output format of ref information]:format:__git_format_ref' \
'--color=-[respect any colors specified in the format]::when:(always never auto)' \
+ '--exclude=[exclude refs which match pattern]:pattern:_git_full_references' \
'*--points-at=[print only refs which point at the given object]:object:__git_commits' \
'*--merged=[print only refs that are merged]:object:__git_commits' \
'*--no-merged=[print only refs that are not merged]:object:__git_commits' \
'*--contains=[print only refs that contain specified commit]:object:__git_commits' \
"*--no-contains=[print only refs that don't contain specified commit]:object:__git_commits" \
'--ignore-case[sorting and filtering are case-insensitive]' \
+ '(1)--stdin[read reference patterns from stdin]' \
+ '--include-root-refs[also include HEAD ref and pseudorefs]' \
'(-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]' \
- ':: :_guard "([^-]?#|)" pattern'
+ ':: :_git_full_references'
}
(( $+functions[_git-for-each-repo] )) ||
_git-for-each-repo() {
_arguments -S \
'(-C --config)'{-C,--config=}'[specify config variable for list of paths]:config variable' \
+ '--keep-going[keep going even if command fails in a repository]' \
':git command:_git_commands' \
'*:: := _git'
}
@@ -5435,15 +5633,15 @@ _git-ls-files () {
'(-c --cached)'{-c,--cached}'[show cached files in output]' \
'(-d --deleted)'{-d,--deleted}'[show deleted files in output]' \
'(-m --modified)'{-m,--modified}'[show modified files in output]' \
- '(-o --others)'{-o,--others}'[show other files in output]' \
+ '(-o --others --format)'{-o,--others}'[show other files in output]' \
'(-i --ignored)'{-i,--ignored}'[show ignored files in output]' \
- '(-s --stage --with-tree)'{-s,--stage}'[show stage files in output]' \
+ '(-s --stage --with-tree --format)'{-s,--stage}'[show stage files in output]' \
'--directory[if a whole directory is classified as "other", show just its name]' \
- '--eol[show line endings of files]' \
+ '(--format)--eol[show line endings of files]' \
$no_empty_directory_opt \
'(-s --stage -u --unmerged --with-tree)'{-u,--unmerged}'[show unmerged files in output]' \
- '--resolve-undo[show resolve-undo information]' \
- '(-k --killed)'{-k,--killed}'[show killed files in output]' \
+ '(--format)--resolve-undo[show resolve-undo information]' \
+ '(-k --killed --format)'{-k,--killed}'[show killed files in output]' \
'-z[separate paths with the NUL character]' \
'*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \
'*'{-X,--exclude-from=-}'[skip files matching patterns in given file]: :_files' \
@@ -5458,6 +5656,8 @@ _git-ls-files () {
'--abbrev=[use specified digits to display object names]:digits' \
'--debug[show debugging data]' \
'--deduplicate[suppress duplicate entries]' \
+ '--sparse[show sparse directories in the presence of a sparse index]' \
+ '(-s --stage -o --others -k --killed --resolve-undo --eol)--format=[specify format to use for the output]:format' \
'*:: :_files'
}
@@ -5467,8 +5667,9 @@ _git-ls-remote () {
_arguments -S -s $endopt \
'(-q --quiet)'{-q,--quiet}"[don't print remote URL]" \
'--upload-pack=[specify path to git-upload-pack on remote side]:remote path' \
- '(-h --heads)'{-h,--heads}'[show only refs under refs/heads]' \
- '(-t --tags)'{-t,--tags}'[show only refs under refs/tags]' \
+ '(-b --branches)'{-b,--branches}'[limit to branches]' \
+ '!(-b --branches)'{-h,--heads} \
+ '(-t --tags)'{-t,--tags}'[limit to tags]' \
"--refs[don't show peeled tags]" \
'--exit-code[exit with status 2 when no matching refs are found in the remote repository]' \
'--get-url[expand the URL of the given repository taking into account any "url.<base>.insteadOf" config setting]' \
@@ -5488,9 +5689,11 @@ _git-ls-tree () {
'(-t)-d[do not show children of given tree (implies -t)]' \
'-r[recurse into subdirectories]' \
'-t[show tree entries even when going to recurse them]' \
- '(-l --long --name-only --name-status)'{-l,--long}'[show object size of blob entries]' \
+ '(-l --long --name-only --name-status --format)'{-l,--long}'[show object size of blob entries]' \
'-z[use NUL termination on output]' \
- '(--name-only --name-status --abbrev)'{--name-only,--name-status}'[list only filenames, one per line]' \
+ '(--name-only --name-status -l --long --object-only --format --abbrev)'{--name-only,--name-status}'[list only filenames, one per line]' \
+ '(--name-only --name-status --format)--object-only[list only objects]' \
+ '(--name-only --name-status -l --long --object-only)--format=[specify format to use for the output]:format' \
'(--name-only --name-status)--abbrev=[use specified digits to display object names]:digits' \
'--full-name[output full path-names]' \
'(--full-name)--full-tree[do not limit listing to current working-directory]' \
@@ -5525,12 +5728,13 @@ _git-name-rev () {
'*--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \
'--no-refs[clear any previous ref patterns given]' \
'*--exclude=[ignore refs matching specified pattern]:pattern' \
- '(--stdin :)--all[list all commits reachable from all refs]' \
- '(--all :)--stdin[read from stdin and append revision-name]' \
+ '(--annotate-stdin :)--all[list all commits reachable from all refs]' \
+ '(--all :)--annotate-stdin[annotate text from stdin]' \
+ '!(--all : --annotate-stdin)--stdin' \
'--name-only[display only name of commits]' \
'--no-undefined[die with non-zero return when a reference is undefined]' \
'--always[show uniquely abbreviated commit object as fallback]' \
- '(--stdin --all)*: :__git_commits'
+ '(--annotate-stdin --all)*: :__git_commits'
}
(( $+functions[_git-pack-redundant] )) ||
@@ -5548,7 +5752,7 @@ _git-rev-list () {
declare -A opt_args
declare -a revision_options
- __git_setup_revision_options
+ __git_setup_revision_options -d
_arguments -C -S $endopt \
$revision_options \
@@ -5563,6 +5767,8 @@ _git-rev-list () {
"--no-object-names[don't print the names of the object IDs that are found]" \
'!(--no-object-names)--object-names)' \
'--timestamp[print raw commit timestamp]' \
+ "*--exclude-hidden=[don't include refs that would be hidden by git-receive-pack or git-upload-pack]:value:(fetch receive uploadpack)" \
+ '--disk-usage=-[print space used for storage by the selected commits or objects]::value:(human)' \
'( --bisect-vars --bisect-all)--bisect[show only middlemost commit object]' \
'(--bisect)--bisect-vars[same as --bisect, displaying shell-evalable code]' \
'(--bisect)--bisect-all[display all commit objects between included and excluded commits]' \
@@ -5589,6 +5795,7 @@ _git_rev-list_filters() {
_values 'filter' \
'blob\:none[omit all blobs]' \
'blob\:limit[omit blobs larger than specified size]:size' \
+ 'object\:type[omits objects not of the indicated type]:type:(tag commit tree blob)' \
'sparse\:oid[uses a sparse-checkout specification contained in the blob]:blob-ish' \
'tree\:0[omit blobs and trees with depth exceeding limit]'
}
@@ -5596,24 +5803,26 @@ _git_rev-list_filters() {
(( $+functions[_git-show-index] )) ||
_git-show-index() {
_arguments \
- '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)'
+ '--object-format=[specify the hash algorithm to use]:algorithm:(sha1 sha256)'
}
(( $+functions[_git-show-ref] )) ||
_git-show-ref () {
_arguments -S $endopt \
+ '(exclude)*: :_guard "([^-]?#|)" pattern' \
- list \
'--head[show the HEAD reference, even if it would normally be filtered out]' \
- '--tags[show only refs/tags]' \
- '--heads[show only refs/heads]' \
+ '--tags[show only tags]' \
+ '--branches[show only branches]' '!(--branches)--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]:: :__git_guard_number length' \
'--verify[enable stricter reference checking]' \
'--abbrev=[use specified digits to display object names]:digits' \
'(-q --quiet)'{-q,--quiet}'[do not print any results]' \
- '*: :_guard "([^-]?#|)" pattern' \
- exclude \
- '--exclude-existing=-[filter out existing refs from stdin]:: :_guard "([^-]?#|)" pattern'
+ '(*)--exclude-existing=-[filter out existing refs from stdin]:: :_guard "([^-]?#|)" pattern' \
+ - exists \
+ '--exists[check for reference existence without resolving]' \
}
(( $+functions[_git-unpack-file] )) ||
@@ -5638,7 +5847,7 @@ _git-verify-pack () {
_arguments -S -s $endopt \
'(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \
'(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \
- '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \
+ '--object-format=[specify the hash algorithm to use]:algorithm:(sha1 sha256)' \
'*:index file:_files -g "*.idx(-.)"'
}
@@ -5847,46 +6056,51 @@ _git-upload-pack () {
(( $+functions[_git-check-attr] )) ||
_git-check-attr () {
- local z_opt=
-
- local curcontext=$curcontext state line ret=1
+ local curcontext="$curcontext" z_opt ret=1
+ local -a state line
declare -A opt_args
if (( words[(I)--stdin] )); then
- z_opt='-z[paths are separated with NUL character when reading from stdin]'
+ z_opt='-z[terminate input file list and output records by a NUL character]'
+ else
+ z_opt='-z[separate output records with NUL character]'
fi
- _arguments -C \
- {-a,--all}'[list all attributes that are associated with the specified paths]' \
+ _arguments -C $z_opt \
'--stdin[read file names from stdin instead of from command line]' \
- '--cached[consider .gitattributes in the index only, ignoring the working tree.]' \
- '-z[terminate input and output records by a NUL character]' \
- $z_opt \
+ '(--source)--cached[consider .gitattributes in the index only, ignoring the working tree]' \
+ '(--cached)--source=[specify tree to scan for .gitattributes (useful in bare repo)]:tree object:__git_tree_ishs' \
+ - files \
+ '(-a --all --)'{-a,--all}'[list all attributes that are associated with the specified paths]' \
'(-)--[interpret preceding arguments as attributes and following arguments as path names]' \
- '*:: :->attribute-or-file' && ret=0
+ '*: :__git_cached_files' \
+ - attrs \
+ '*:::attribute:->attributes' && ret=0
case $state in
- (attribute-or-file)
- local -a attributes
-
- attributes=(crlf ident filter diff merge)
-
- local only_attributes=1
- for (( i = 2; i < $#words; i++ )); do
- if (( attributes[(I)$words[i]] == 0 )); then
- only_attributes=0
- break
- fi
- done
-
- if (( !only_attributes )) || [[ -n ${opt_args[(I)--]} ]]; then
- __git_cached_files && ret=0
- else
- _alternative \
- 'attributes::__git_attributes' \
- 'files::__git_cached_files' && ret=0
- fi
- ;;
+ attributes)
+ local -a attributes plain dedup
+ attributes=(
+ crlf:"line-ending convention (deprecated)"
+ text:"line-ending normalization"
+ eol:"line-ending style"
+ working-tree-encoding:"text encoding in working directory"
+ ident:'$Id$ substitution'
+ filter:"filters"
+ diff:"textual diff"
+ merge:"merging strategy"
+ conflict-marker-size:"length of markers left in the work tree"
+ whitespace:"control over what diff and apply should consider whitespace errors"
+ export-ignore:"exclude from archive files"
+ export-subst:"expand placeholders when adding to an archive"
+ delta:"don't attempt compression of blobs"
+ encoding:"character encoding that should be used by GUI tools"
+ )
+ plain=( ${attributes%%:*} )
+ dedup=( "${(@)words[1,CURRENT-1]}" )
+ (( ! ${#dedup:|plain} )) && _describe -t git-attributes \
+ attribute attributes -F dedup && ret=0
+ ;;
esac
return ret
@@ -5910,9 +6124,28 @@ _git-fmt-merge-msg () {
'( --no-log)--log=-[display one-line descriptions from actual commits being merged]::number of commits [20]' \
'(--log )--no-log[do not display one-line descriptions from actual commits being merged]' \
'(-m --message)'{-m+,--message=}'[use given message instead of branch names for first line in log message]:message' \
- '(-F --file)'{-F,--file}'[specify list of merged objects from file]: :_files'
+ '--into-name=[specify substitute name for the real target branch to use]:name' \
+ '(-F --file)'{-F+,--file=}'[specify list of merged objects from file]: :_files'
+}
+
+(( $+functions[_git-hook] )) ||
+_git-hook() {
+ local -a args
+ local gitdir=$(_call_program gitdir git rev-parse --git-dir)
+ [[ -f $gitdir/gitdir ]] && gitdir=$(<$gitdir/gitdir) # needed in worktrees
+
+ (( ${(M)#words[1,CURRENT-1]:#[^-]*} >= 3 )) && args=(
+ {--,--end-of-options}'[end options to git hook, allowing options to the hook itself]'
+ )
+ [[ -n ${(M)words[1,CURRENT-1]:#--(|end-of-options)} ]] && args=( '*:: :_default' )
+ _arguments $args \
+ '--ignore-missing[ignore any missing hook by quietly returning zero]' \
+ "--to-stdin=[specify file which will be redirected to hook's stdin]:file:_files" \
+ '1:subcommand:(run)' \
+ '2:hook name:compadd $gitdir/hooks/*(x\:t)'
}
+
(( $+functions[_git-mailinfo] )) ||
_git-mailinfo () {
# TODO: --no-inbody-headers is undocumented.
@@ -5952,7 +6185,8 @@ _git-merge-one-file () {
_git-patch-id () {
_arguments \
'--stable[use a sum of hashes unaffected by diff ordering]' \
- '--unstable[use patch-id compatible with git 1.9 and older]'
+ '--unstable[use patch-id compatible with git 1.9 and older]' \
+ "--verbatim[don't strip whitespace from the patch]"
}
# NOTE: git-sh-setup isn't a user command.
@@ -6159,6 +6393,7 @@ _git_commands () {
pack-refs:'pack heads and tags for efficient repository access'
prune:'prune all unreachable objects from the object database'
reflog:'manage reflog information'
+ refs:'low-level access to refs'
remote:'manage set of tracked repositories'
repack:'pack unpacked objects in a repository'
replace:'create, list, delete refs to replace objects')
@@ -6167,6 +6402,7 @@ _git_commands () {
blame:'show what revision and author last modified each line of a file'
bugreport:'collect information for user to file a bug report'
count-objects:'count unpacked objects and display their disk consumption'
+ diagnose:'generate an archive of diagnostic information'
difftool:'show changes using common diff tools'
fsck:'verify connectivity and validity of objects in database'
help:'display help information about git'
@@ -6196,7 +6432,7 @@ _git_commands () {
checkout-index:'copy files from index to working directory'
commit-graph:'write and verify Git commit-graph files'
commit-tree:'create new commit object'
- hash-object:'compute object ID and optionally create a blob from a file'
+ hash-object:'compute object ID and optionally create an object from a file'
index-pack:'build pack index file for an existing packed archive'
merge-file:'run a three-way file merge'
merge-index:'run merge for files needing merging'
@@ -6258,6 +6494,7 @@ _git_commands () {
check-ref-format:'ensure that a reference name is well formed'
column:'display data in columns'
fmt-merge-msg:'produce merge commit message'
+ hook:'run git hooks'
mailinfo:'extract patch and authorship from a single email message'
mailsplit:'split mbox file into a list of files'
merge-one-file:'standard helper-program to use with git merge-index'
@@ -6301,6 +6538,18 @@ _git_commands () {
_alternative $alts
}
+(( $+functions[_git_help_guides] )) ||
+_git_help_guides() {
+ local -a guides userint devint
+ guides=( ${${${(M)${(f)"$(_call_program git-guides git help -g)"}:# *}## #}/ ##/:} )
+ userint=( ${${${(M)${(f)"$(_call_program git-guides git help --user-interfaces)"}:# *}## #}/ ##/:} )
+ devint=( ${${${(M)${(f)"$(_call_program git-guides git help --developer-interfaces)"}:# *}## #}/ ##/:} )
+ _alternative \
+ 'git-guides: : _describe -t git-guides guide guides' \
+ 'user-interfaces: : _describe -t user-interfaces "user interface" userint' \
+ 'developer-interfaces: : _describe -t developer-interfaces "developer interfaces" devint'
+}
+
(( $+functions[__git_aliases] )) ||
__git_aliases () {
local -a aliases
@@ -6338,7 +6587,7 @@ __git_date_formats () {
declare -a date_formats
if compset -P 'format(-local|):'; then
- _strftime
+ _date_formats
return
fi
@@ -6565,20 +6814,6 @@ __git_compression_levels () {
'9:maximum compression'
}
-(( $+functions[__git_attributes] )) ||
-__git_attributes () {
- local -a attributes
-
- attributes=(
- 'crlf:line-ending convention'
- 'ident:ident substitution'
- 'filter:filters'
- 'diff:textual diff'
- 'merge:merging strategy')
-
- _describe -t attributes attribute attributes $*
-}
-
(( $+functions[__git_daemon_service] )) ||
__git_daemon_service () {
local -a services
@@ -6994,7 +7229,6 @@ __git_heads_remote () {
(( $+functions[__git_commit_objects] )) ||
__git_commit_objects () {
- local gitdir expl start
declare -a commits
if [[ -n $PREFIX[(r)@] ]] || [[ -n $SUFFIX[(r)@] ]]; then
@@ -7016,7 +7250,7 @@ __git_commit_objects () {
(( $+functions[__git_recent_commits] )) ||
__git_recent_commits () {
- local gitdir expl start
+ local expl
declare -a descr tags heads commits argument_array_names commit_opts
local h i j k ret
integer distance_from_head
@@ -7300,6 +7534,16 @@ __git_remote_references () {
__git_references
}
+(( $+functions[_git_full_references] )) ||
+_git_full_references() {
+
+ if [[ $_git_full_refs_cache_pwd != $PWD ]]; then
+ _git_full_refs_cache=( ${(f)"$(_call_program references 'git for-each-ref --format=%\(refname\)')"} )
+ _git_full_refs_cache_pwd=$PWD
+ fi
+ _multi_parts "$@" / _git_full_refs_cache
+}
+
(( $+functions[__git_notes_refs] )) ||
__git_notes_refs () {
local expl
@@ -7369,7 +7613,7 @@ __git_files () {
# First allow ls-files to pattern-match in case of remote repository. Use the
# icase pathspec magic word to ensure that we support case-insensitive path
# completion for users with the appropriate matcher configuration
- files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+:\(icase\)$pref\*}:-.} 2>/dev/null)"})
+ files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+:\(icase\)${(qq)pref}\*}:-.} 2>/dev/null)"})
__git_command_successful $pipestatus || return
# If ls-files succeeded but returned nothing, try again with no pattern. Note
@@ -7395,6 +7639,19 @@ __git_deleted_files () {
__git_files --deleted deleted-files 'deleted file' $*
}
+(( $+functions[__git_trailers_tokens] )) ||
+__git_trailers_tokens() {
+ declare -a trailers
+ local i
+
+ local -a gtrailers=( $(_call_program trailers git config --name-only --get-regexp '^trailer\..*\.key$') )
+ for i in $gtrailers; do
+ i=( ${${(@s:.:)i}[2,-2]} )
+ trailers+=( ${(j|.|)i} )
+ done
+ _wanted trailers expl "trailer" compadd -a trailers
+}
+
(( $+functions[__git_modified_files] )) ||
__git_modified_files () {
__git_files --modified modified-files 'modified file' $*
@@ -7616,10 +7873,65 @@ __git_guard_bytes () {
_numbers -u bytes ${*:-size} k m g
}
-(( $+functions[__git_datetimes] )) ||
-__git_datetimes () {
- # TODO: Use this in more places.
- _guard '*' 'time specification'
+(( $+functions[_git_approxidates] )) ||
+_git_approxidates() {
+ local MATCH MBEGIN MEND
+ local match mbegin mend
+ local -i date time num
+ local -a months=( January February March April May June July August September
+ October November December )
+ local -a weekdays=( Sunday Monday Tuesday Wednesday Thursday Friday Saturday )
+ local -a numbers=( zero one two three four five six seven eight nine ten )
+ local -a periods=( second minute hour day week month year )
+ local -a suf=( -S. -r "._,+\\ \t\n\-" )
+
+ local -a pexpl
+ zparseopts -D -E X+:=pexpl
+
+ local -a query=(
+ \( /$'*\0[ \t\n]#'/ \)
+ \( '/[]/' ':dates:date:compadd "${pexpl[@]:/-X/-x}"'
+ \| '/(@|[0-9](#c9))/' ':specials:special:compadd -S "" @' '/[]/' ': _message -e epochtimes "seconds since Unix epoch"'
+ \| '/(#i)(now|never)/' '%?%' ':specials:special:(now never)' '/[]/'
+ \| \)
+ \(
+ \( '/(#i)(one|last)/' '%[ ._,+]%' -'num=1'
+ \| '/[0-9](#c2,4)(-|/|.|)[0-9](#c1,2)(-|/|.|)[0-9](#c1,4)(|T)/' -'date=3'
+ \| '/[0-9](#c2)(:|)[0-9](#c2)(:|)[0-9](#c2)(.<->|)/' -'time=1'
+ \| '/20/' -'((!date))' '/[]/' ':dates:date:_dates -f "%y-%m-%d"'
+ \| '/1/' -'num=1'
+ \| '/<->/' -'num=2'
+ \| "/(#i)(${(j.|.)numbers})/" '%[ ._,+]%' -'num=2'
+ \| "/(#i)(${(j.|.)${(@)months//(#b)(???)(*)/$match[1]${match[2]//(#m)?/(|$MATCH}${match[2]//?/)}}})/"
+ '%[ ._,+]%' -'(( num = 0, date |= 2 ))'
+ \| "/(#i)(${(j.|.)${(@)weekdays//(#b)(???)(*)/$match[1]${match[2]//(#m)?/(|$MATCH}${match[2]//?/)}}})(|s)/"
+ '%[ ._,+]%' -'(( num = 0, date |= 1 ))'
+ \| '/(#i)yesterday/' '%[ ._,+]%' -'date=3'
+ \| "/(#i)(${(j.|.)${(@)periods%s}})(|s)/" '%[ ._,+]%' -'num=0'
+ \| '/(#i)(noon|midnight|tea|[ap]m)/' '%[ ._,+]%' -'time=1'
+ \|
+ \( // -'(( !(date&2) ))' // ':months:month:compadd -o nosort $suf -a months' \| \)
+ \( // -'(( num <= 1 && !(date&1) ))' // ':weekdays:weekday:compadd $suf -o nosort -a weekdays' \| \)
+ \( // -'(( num > 1 ))'
+ \( // -'(( date < 3 ))' // ':periods:period:compadd $suf -o nosort ${^periods[4,-1]}s' \| \)
+ \( // -'(( !(date&1) ))' // ':weekdays:weekday:compadd $suf -o nosort ${^weekdays}s' \| \)
+ \( // -'(( !time ))' // ':periods:period:compadd $suf -o nosort ${^periods[1,3]}s' \| \)
+ \| // -'(( num == 1 ))'
+ \( // -'(( date < 3 ))' // ':periods:period:compadd $suf -o nosort -a "periods[4,-1]"' \| \)
+ \( // -'(( !time ))' // ':periods:period:compadd $suf -o nosort -a "periods[1,3]"' \| \)
+ \| // -'(( num == 0 ))'
+ \( // -'(( !time ))' // ':specials:special:compadd $suf noon midnight tea AM PM' \| \)
+ \( // -'(( !date ))' // ':specials:special:compadd $suf yesterday' \| \)
+ // ':specials:special:compadd $suf last' # "last" is equivalent to "one"
+ // ':numbers:number:compadd $suf -n -o nosort -a numbers'
+ \)
+ '/[]/'
+ \) '/([ ._,+]|)/'
+ \) \#
+ )
+
+ _regex_arguments _git_dates "$query[@]"
+ _git_dates
}
(( $+functions[__git_stages] )) ||
@@ -7639,6 +7951,7 @@ __git_setup_log_options () {
# TODO: Need to implement -<n> for limiting the number of commits to show.
log_options=(
'(- *)-h[display help]'
+ '--clear-decorations[clear all previously-defined decoration filters]'
'--decorate-refs=[only decorate refs that match pattern]:pattern'
"--decorate-refs-exclude=[don't decorate refs that match pattern]:pattern"
'( --no-decorate)--decorate=-[print out ref names of any commits that are shown]: :__git_log_decorate_formats'
@@ -7679,8 +7992,9 @@ __git_setup_diff_options () {
local exclusive_diff_options='(--name-only --name-status --check -s --no-patch)'
diff_options=(
- {-p,-u,--patch}'[generate diff in patch format]'
- {-U,--unified=}'[generate diff with given lines of context]: :__git_guard_number lines'
+ '(-p -u --patch)'{-p,-u,--patch}'[generate diff in patch format]'
+ '(-U --unified -W --function-context)'{-U-,--unified=-}'[generate diff with given lines of context]:: :__git_guard_number lines'
+ '(-U --unified -W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \
'--raw[generate default raw diff output]'
'--patch-with-raw[generate patch but also keep the default raw diff output]'
$exclusive_diff_options{-s,--no-patch}'[suppress diff output]'
@@ -7761,7 +8075,6 @@ __git_setup_diff_options () {
'--output-indicator-new=[specify the character to indicate a new line]:character [+]'
'--output-indicator-old=[specify the character to indicate a old line]:character [-]'
'--output-indicator-context=[specify the character to indicate a context line]:character [ ]'
- '--exit-code[report exit code 1 if differences, 0 otherwise]'
'( --no-ext-diff)--ext-diff[allow external diff helper to be executed]'
'(--ext-diff )--no-ext-diff[disallow external diff helper to be executed]'
'(--textconv --no-textconv)--textconv[allow external text conversion filters to be run when comparing binary files]'
@@ -7770,9 +8083,13 @@ __git_setup_diff_options () {
'(--no-prefix)--src-prefix=[use given prefix for source]:prefix'
'(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix'
'--line-prefix=[prepend additional prefix to every line of output]:prefix'
- '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]'
+ "(--src-prefix --dst-prefix)--no-prefix[don't show any source or destination prefix]"
+ '!(--src-prefix --dst-prefix --no-prefix)--default-prefix'
'(-c --cc)'{-c,--cc}'[combined diff format for merge commits]'
- '--output=[output to a specific file]: :_files')
+ '--output=[output to a specific file]: :_files'
+ '--expand-tabs=-[replace each tab with spaces]::tab width [8]'
+ '!(--expand-tabs)--no-expand-tabs'
+ )
}
(( $+functions[__git_setup_diff_stage_options] )) ||
@@ -7882,11 +8199,15 @@ __git_format_placeholders() {
(( $+functions[__git_setup_revision_options] )) ||
__git_setup_revision_options () {
- local -a diff_options
- __git_setup_diff_options
+ if [[ $1 = "-d" ]]; then # don't include diff options if passed -d
+ revision_options=()
+ else
+ local -a diff_options
+ __git_setup_diff_options
+ revision_options=( $diff_options )
+ fi
- revision_options=(
- $diff_options
+ revision_options+=(
'(-v --header)'{--pretty=-,--format=-}'[pretty print commit messages]::format:__git_format_placeholders'
'(--abbrev-commit --no-abbrev-commit)--abbrev-commit[show only partial prefixes of commit object names]'
'(--abbrev-commit --no-abbrev-commit)--no-abbrev-commit[show the full 40-byte hexadecimal commit object name]'
@@ -7906,8 +8227,8 @@ __git_setup_revision_options () {
'--count[display how many commits would have been listed]'
'(-n --max-count)'{-n+,--max-count=}'[maximum number of commits to display]: :__git_guard_number'
'--skip=[skip given number of commits before output]: :__git_guard_number'
- '(--max-age --since --after)'{--since=,--after=}'[show commits more recent than given date]:date'
- '(--min-age --until --before)'{--until=,--before=}'[show commits older than given date]: :__git_guard_number timestamp'
+ '(--max-age --since --after)'{--since=,--after=}'[show commits more recent than given date]: :_git_approxidates'
+ '(--min-age --until --before)'{--until=,--before=}'[show commits older than given date]: :_git_approxidates'
'( --since --after)--max-age=-[maximum age of commits to output]: :__git_guard_number timestamp'
'( --until --before)--min-age[minimum age of commits to output]: :__git_guard_number timestamp'
'*--author=[limit commits to those by given author]:author'
@@ -7934,8 +8255,7 @@ __git_setup_revision_options () {
'--tags=-[show all commits from refs/tags]::pattern'
'--remotes=-[show all commits from refs/remotes]::pattern'
'--glob=[show all commits from refs matching glob]:pattern'
- '--exclude=[do not include refs matching glob]:pattern'
- '--exclude=[do not include refs matching glob]:pattern'
+ "--exclude=[don't include refs matching glob]:pattern"
'--ignore-missing[ignore invalid object an ref names on command line]'
'--bisect[pretend as if refs/bisect/bad --not refs/bisect/good-* was given on command line]'
'(-g --walk-reflogs --reverse)'{-g,--walk-reflogs}'[walk reflog entries from most recent to oldest]'
@@ -8021,6 +8341,7 @@ __git_setup_fetch_options () {
'--refmap=[specify refspec to map refs to remote tracking branches]:refspec'
'(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]'
'(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]'
+ '--porcelain[machine-readable output]'
'--dry-run[show what would be done, without making any changes]'
'(-f --force)'{-f,--force}'[force overwrite of local reference]'
'(-k --keep)'{-k,--keep}'[keep downloaded pack]'
@@ -8415,7 +8736,7 @@ _git() {
# TODO: This needs an update
# TODO: How do we fix -c argument?
_arguments -C \
- '(- :)--version[display version information]' \
+ '(- :)'{-v,--version}'[display version information]' \
'(- :)--help[display help message]' \
'-C[run as if git was started in given path]: :_directories' \
\*{-c,--config-env=}'[pass configuration parameter to command]: :->configuration' \
@@ -8428,9 +8749,11 @@ _git() {
'--git-dir=[path to repository]: :_directories' \
'--work-tree=[path to working tree]: :_directories' \
'--namespace=[set the Git namespace]:namespace' \
- '--super-prefix=[set a prefix which gives a path from above a repository down to its root]:path:_directories' \
'--bare[use $PWD as repository]' \
'--no-replace-objects[do not use replacement refs to replace git objects]' \
+ "--no-lazy-fetch[don't fetch missing objects from the promisor remote on demand]" \
+ "--no-optional-locks[don't perform optional operations that require locks]" \
+ '--no-advice[disable all advice hints from being printed]' \
'--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \
'(-): :->command' \
'(-)*:: :->option-or-argument' && return