From a7e4394d1b06cbd004c85b5fecfe864eb93b4385 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 22 Oct 2022 20:26:23 -0700 Subject: 50714: also complete in the 2nd argument of "git diff" anything that could be in the 1st argument. This probably shouldn't complete ranges but all other code is in common, so leaving it to someone more familiar with _git to clean up. --- Completion/Unix/Command/_git | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index cecb80ac3..6a1c4158a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -808,18 +808,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 +829,19 @@ _git-diff () { elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then # Example: git diff --cached file1 __git_changed-in-index_files && ret=0 - else - # Example: git diff file1 - __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 -- cgit v1.2.3 From 3a08f682885b1d83b6b573e2f1c0122ec5b6f5db Mon Sep 17 00:00:00 2001 From: Jörg Sommer Date: Tue, 27 Dec 2022 17:49:50 +0100 Subject: 51256: Add --refetch to completions of git-fetch --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 1 + 2 files changed, 4 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 7213bf5f0..d6475c3a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2023-01-11 Oliver Kiddle + * Jörg Sommer: 51256: Completion/Unix/Command/_git: + Add --refetch to completions of git-fetch + * unposted: NEWS, Src/zsh.h, Completion/Zsh/Type/_ps1234: mention attributes changes, fix renumbering mistake and allow completion to offer prompt escapes for PROMPT_EOL_MARK diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 6a1c4158a..14fa01436 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -890,6 +890,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]" \ -- cgit v1.2.3 From 37569049f092a841047413709cd39b2480211ecc Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 21 Jan 2023 19:21:30 -0800 Subject: 51313: fix "git rerere forget" completion --- ChangeLog | 2 ++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 2143d9fcb..3ceb2aa73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2023-01-21 Bart Schaefer + * 51313: Completion/Unix/Command/_git: fix "git rerere forget" + * 51310: Src/Zle/zle_main.c: zle -F handlers preserve LASTWIDGET 2023-01-16 Peter Stephenson diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 14fa01436..b3ed7b5c8 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4259,14 +4259,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]' \ -- cgit v1.2.3 From 619cf4fbd5843b3b6cb94be3ce5a2953bfc29dc5 Mon Sep 17 00:00:00 2001 From: Øystein Walle Date: Fri, 10 Feb 2023 08:23:01 +0100 Subject: 51391: complete remote branch names respecting --delete for git push --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 9e7608293..d4701b99b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-02-17 Oliver Kiddle + + * Øystein Walle: 51391: Completion/Unix/Command/_git: + complete remote branch names respecting --delete for git push + 2023-02-14 Bart Schaefer * 51437: Src/params.c, Test/K01nameref.ztst: Fix incorrectly-passed diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b3ed7b5c8..a2555cbf0 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1459,6 +1459,14 @@ _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/]' \ '--prune[remove remote branches that do not have a local counterpart]' \ @@ -1494,7 +1502,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) -- cgit v1.2.3 From 76be800073255eb3cdc1bcdec3159a973f163ad7 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 19 Feb 2023 15:06:45 +0100 Subject: 51456: complete only modified files with git add -u Also fix a typo, add a missing =, add a prompt for function name after git blame -L and git worktree --force has gained a short -f form. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index b5bb1da99..8cca5d1e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2023-02-19 Oliver Kiddle + * 51456: Completion/Unix/Command/_git: complete only modified + files with git add -u + * 51455, 51461: Completion/Unix/Type/_ldap_attributes Completion/BSD/Command/_ldap, Completion/Unix/Command/_openldap, Completion/Unix/Type/_ldap_filters: new completion for the OpenLDAP diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a2555cbf0..49f9fa504 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 @@ -2365,7 +2369,7 @@ _git-worktree() { _arguments -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]:time' && ret=0 ;; (list) _arguments -S $endopt '--porcelain[machine-readable output]' && ret=0 @@ -2379,7 +2383,8 @@ _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 ;; (unlock) @@ -3901,7 +3906,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]' \ @@ -4134,7 +4139,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 -- cgit v1.2.3 From 211682b78faf253b6d02cea7371f2fe03ada36f1 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 11 Mar 2023 13:52:05 +0100 Subject: 51539: don't complete diff options to git blame --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 42 ++++++++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 14 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index f15072191..c32e38e7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-03-11 Oliver Kiddle + + * 51539: Completion/Unix/Command/_git: don't complete diff + options to git blame + 2023-03-07 Bart Schaefer * 51534: Util/printdefines: update for recent changes diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 49f9fa504..1a9c79034 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -393,7 +393,7 @@ _git-bundle () { ':bundle:_files' && ret=0 else local revision_options - __git_setup_revision_options + __git_setup_revision_options -d _arguments -S -s \ $revision_options \ @@ -783,6 +783,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]' \ @@ -974,6 +975,7 @@ _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 @@ -4096,7 +4098,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 \ @@ -5344,8 +5346,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' } @@ -5362,16 +5367,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' \ @@ -5560,7 +5567,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 \ @@ -7691,8 +7698,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]' @@ -7773,7 +7781,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]' @@ -7784,7 +7791,10 @@ __git_setup_diff_options () { '--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]' '(-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] )) || @@ -7894,11 +7904,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]' -- cgit v1.2.3 From 9bd477dce9a5887d42a5365aaf8906ac1f118510 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 16 Mar 2023 22:16:52 +0100 Subject: 51583: update completion of git attributes --- ChangeLog | 3 ++ Completion/Unix/Command/_git | 81 ++++++++++++++++++++------------------------ 2 files changed, 39 insertions(+), 45 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 4143984e3..ec32f1029 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2023-03-16 Oliver Kiddle + * 51583: Completion/Unix/Command/_git: update completion of + git attributes + * 51582: Completion/Unix/Command/_ssh: openssh 9.3 completion update * 51581: Completion/BSD/Command/_fw_update, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1a9c79034..1c3a95031 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5866,46 +5866,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 @@ -6584,20 +6589,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 -- cgit v1.2.3 From 324d0e7cc710fd0dd8e3a50ccc0a4ba57ec6cb7a Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 27 Mar 2023 21:11:34 +0200 Subject: 51603: complete dates and times in the form that git accepts --- ChangeLog | 7 ++- Completion/Unix/Command/_git | 101 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 88 insertions(+), 20 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index c575a0b3c..a2fba2ff9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ +2023-03-27 Oliver Kiddle + + * 51603: Completion/Unix/Command/_git: complete dates and times + in the form that git accepts + 2023-03-22 Peter Stephenson * 51586: Src/builtin.c: When printf "%s" encounters a byte - that's not part of a vaild multibyte character it should handle + that's not part of a valid multibyte character it should handle it a single byte at a time. 2023-03-16 Oliver Kiddle diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1c3a95031..1d4fe20c9 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -996,7 +996,7 @@ _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' \ + '( --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]' \ '(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' \ '--keep-largest-pack[repack all other packs except the largest pack]' \ @@ -2371,10 +2371,14 @@ _git-worktree() { _arguments -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 @@ -3851,7 +3855,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' } @@ -3899,8 +3903,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]' \ @@ -4046,8 +4050,10 @@ _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' \ '-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]" \ @@ -4055,7 +4061,7 @@ _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' \ @@ -4358,8 +4364,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 is a valid repository or gitfile and print location]:git dir:_files -/' \ '*: :__git_objects' && ret=0 fi @@ -4399,7 +4405,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 @@ -4961,7 +4967,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 @@ -5130,7 +5136,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 \ @@ -7626,10 +7634,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] )) || @@ -7923,8 +7986,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' -- cgit v1.2.3 From fa17566b658f8bc42f958a68ff9df634667b4def Mon Sep 17 00:00:00 2001 From: Wesley Schwengle Date: Wed, 13 Sep 2023 22:53:04 -0400 Subject: 52141: Add trailer token completion for git commit --trailer Via 842587016d in the git project there has been support for git commit trailer tokens for the bash completion system. This commit adds similar support to zsh. It includes additional hardening of the regexp and allows for tokens which include a '.'. This can be found in git via 9a0ec17606. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 55dd9ab8a..6b1752c7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2023-09-20 Oliver Kiddle + * Wesley Schwengle: 52141: Completion/Unix/Command/_git: add trailer + token completion for git commit --trailer + * 52163: Completion/Unix/Command/_zfs: completion update for OpenZFS 2.2 diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1d4fe20c9..cefc88c5a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -717,7 +717,7 @@ _git-commit () { {-p,--patch}'[use the interactive patch selection interface to chose 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(s)]: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]' \ @@ -7413,6 +7413,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' $* -- cgit v1.2.3 From d8a3bff4f5b4d3df42de8f03adc70f8d0721398f Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 9 Nov 2023 16:48:12 +0100 Subject: 52280: update git completion for new options in git through to version 2.42.0 --- ChangeLog | 5 + Completion/Unix/Command/_git | 331 +++++++++++++++++++++++++++++++------------ 2 files changed, 243 insertions(+), 93 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 0c51a3464..a3ce2e8d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-11-09 Oliver Kiddle + + * 52280: Completion/Unix/Command/_git: update git completion for new + options in git through to version 2.42.0 + 2023-11-08 Oliver Kiddle * github #105: Shotaro Aoyama: Completion/Zsh/Command/_zle: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index cefc88c5a..7370aaead 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -123,7 +123,10 @@ _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)' \ + '(--empty)--allow-empty[record the empty patch as an empty commit]' \ + '(--allow-empty)--empty=[select hanndling of empty patches]:handling:(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]' \ @@ -164,8 +167,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 \ @@ -333,7 +338,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]" \ @@ -345,6 +351,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 \ @@ -354,6 +361,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 } @@ -387,8 +395,7 @@ _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 @@ -468,13 +475,14 @@ _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-guess)--guess' \ @@ -533,10 +541,7 @@ _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]' \ @@ -544,15 +549,21 @@ _git-cherry-pick () { '(-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] )) || @@ -646,9 +657,9 @@ _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}'[= 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]" \ @@ -660,8 +671,10 @@ _git-clone () { '(-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 @@ -714,7 +727,7 @@ _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:__git_trailers_tokens' \ @@ -726,8 +739,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"))' \ @@ -998,6 +1011,7 @@ _git-gc () { '--auto[check whether housekeeping is required]' \ '( --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]' \ } @@ -1060,6 +1074,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 \ @@ -1297,6 +1312,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]' \ @@ -1336,6 +1352,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 \ @@ -1373,12 +1390,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) @@ -1409,14 +1432,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 ;; @@ -1474,13 +1489,13 @@ _git-push () { 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' \ @@ -1592,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' } @@ -1611,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' \ @@ -1650,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]' \ @@ -1702,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' } @@ -1844,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 @@ -1854,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 @@ -1879,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 \ @@ -1904,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 @@ -1940,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) @@ -1962,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 ;; @@ -2068,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]' \ @@ -2082,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) @@ -2153,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 @@ -2250,9 +2288,10 @@ _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' \ @@ -2313,6 +2352,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' \ @@ -2344,6 +2384,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' ) @@ -2358,17 +2399,24 @@ _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]: :_git_approxidates' && ret=0 @@ -2393,6 +2441,9 @@ _git-worktree() { '(-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 ;; @@ -3846,7 +3897,11 @@ _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]' \ + '*--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] )) || @@ -3992,7 +4047,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 ;; @@ -4071,7 +4128,8 @@ _git-repack () { '--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' } (( $+functions[_git-replace] )) || @@ -4159,8 +4217,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] )) || @@ -4180,6 +4239,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? @@ -4209,9 +4276,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' } @@ -4224,14 +4292,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] )) || @@ -4268,7 +4341,16 @@ _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' \ ':base-tree:__git_tree_ishs' \ ':branch 1:__git_tree_ishs' \ ':branch 2:__git_tree_ishs' @@ -4584,6 +4666,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' \ @@ -4911,7 +4995,7 @@ _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")]' \ @@ -4926,8 +5010,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' } @@ -4944,8 +5030,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)' \ @@ -5054,7 +5141,8 @@ _git-merge-file () { '(--ours --union)--theirs[resolve conflicts favoring their side of the lines]' \ '(--ours --theirs )--union[resolve conflicts favoring both sides of the lines]' \ '--marker-size[specify length of conflict markers]: :__git_guard_number "marker length"' \ - '--diff3[use a diff3 based merge]' \ + '(--zdiff3)--diff3[show conflicts in "diff3" style]' \ + '(--diff3)--zdiff3[show conflicts in "zdiff3" style]' \ ':current file:_files' \ ':base file:_files' \ ':other file:_files' @@ -5216,6 +5304,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' } @@ -5311,8 +5400,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]' \ @@ -5321,12 +5410,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] )) || @@ -5423,21 +5514,24 @@ _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]' \ '(-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] )) || @@ -5462,15 +5556,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' \ @@ -5485,6 +5579,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' } @@ -5515,9 +5611,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]' \ @@ -5552,12 +5650,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] )) || @@ -5590,6 +5689,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]' \ @@ -5942,9 +6043,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. @@ -5984,7 +6104,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. @@ -6199,6 +6320,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' @@ -6228,7 +6350,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' @@ -6290,6 +6412,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' @@ -6333,6 +6456,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 @@ -6370,7 +6505,7 @@ __git_date_formats () { declare -a date_formats if compset -P 'format(-local|):'; then - _strftime + _date_formats return fi @@ -7012,7 +7147,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 @@ -7034,7 +7168,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 @@ -7318,6 +7452,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 @@ -7725,6 +7869,7 @@ __git_setup_log_options () { # TODO: Need to implement - 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' @@ -7856,7 +8001,8 @@ __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' '--expand-tabs=-[replace each tab with spaces]::tab width [8]' @@ -8027,8 +8173,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]' @@ -8114,6 +8259,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]' @@ -8508,7 +8654,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' \ @@ -8521,7 +8667,6 @@ _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]' \ '--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \ -- cgit v1.2.3 From 7f196de9d7f1034a6a8cc7730280f21f7eb0a7f3 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Fri, 24 May 2024 19:22:44 -0700 Subject: 52904: Improve quoting of paths passed via _call_program to "git ls-files" --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index d4610155f..642b40821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-05-24 Bart Schaefer + + * 52904: Completion/Unix/Command/_git: Improve quoting of paths + passed via _call_program to "git ls-files" + 2024-05-20 Mikael Magnusson * 52895: Completion/Unix/Type/_baudrates: Partial revert of diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 7370aaead..22b945e38 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7531,7 +7531,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 -- cgit v1.2.3 From 8a811b369b8c7338a90bb85e12bc9f0cfb2b6b6d Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Tue, 13 Aug 2024 22:32:34 -0400 Subject: 53031: Completion/Unix/Command/_git: add missing terminator in case statement --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 1 + 2 files changed, 6 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 667f17177..1ed2100f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-08-13 Eric Cook + + * 53031: Christian Heusel: Completion/Unix/Command/_git: add + missing terminator in case statement + 2024-08-06 Bart Schaefer * Jun.T: 53026: Src/params.c: fix failure to free old value when diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 22b945e38..6c6d59b24 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -278,6 +278,7 @@ _git-bisect () { _arguments -C -s \ $log_options \ $revision_options && ret=0 + ;; (*) _nothing ;; -- cgit v1.2.3 From 06e66b6b5af3778998aef0455aaaf6dfdf7e5145 Mon Sep 17 00:00:00 2001 From: Semnodime Date: Wed, 29 May 2024 06:33:55 +0200 Subject: github #120: Update _git to reflect `--recursive` being an alias `--recursive` and `--recurse-submodules` are aliased according to https://github.com/git/git/blob/99c33bed562b41de6ce9bd3fd561303d39645048/builtin/clone.c#L105 --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 6372bb05d..753353153 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2024-08-31 Oliver Kiddle + * github #120: Semnodime: Completion/Unix/Command/_git: update + _git to reflect `--recursive` being an alias + * 53058: Completion/Unix/Command/_zstd: new completion for zstd * 53057: Completion/Zsh/Context/_equal: complete glob qualifiers diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 6c6d59b24..86b8a7455 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -665,7 +665,6 @@ _git-clone () { '(--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 -/' \ \*--server-option='[send specified string to the server when using protocol version 2]:option' \ -- cgit v1.2.3 From 65285fac236dec95564bdd082ac637976c9d41c4 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 27 Jan 2025 23:14:34 +0100 Subject: 53327: update for git 2.47 --- ChangeLog | 2 + Completion/Unix/Command/_git | 136 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 116 insertions(+), 22 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index cb90a5736..2a596af97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2025-01-27 Oliver Kiddle + * 53327: Completion/Unix/Command/_git: update for git 2.47 + * 53328: Completion/Linux/Command/_cpupower, Completion/Linux/Command/_cryptsetup, Completion/Linux/Command/_ethtool, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 86b8a7455..a442b45d2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -123,8 +123,9 @@ _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 hanndling of empty patches]:handling:(stop drop keep)' \ + '(--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]' \ @@ -487,7 +488,7 @@ _git-checkout () { '(-)'{-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-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]' \ @@ -546,7 +547,8 @@ _git-cherry-pick () { '--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' \ @@ -667,6 +669,7 @@ _git-clone () { '--shallow-submodules[any cloned submodules will be shallow]' \ '(--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]' \ @@ -730,7 +733,7 @@ _git-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:__git_trailers_tokens' \ + '*--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]' \ @@ -947,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' \ @@ -967,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 -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' \ @@ -993,7 +998,7 @@ _git-format-patch () { 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 @@ -1009,6 +1014,7 @@ _git-gc () { _arguments -S -s $endopt \ '--aggressive[more aggressively optimize]' \ '--auto[check whether housekeeping is required]' \ + '--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]' \ @@ -1190,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' } @@ -1207,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' } @@ -1592,7 +1599,7 @@ _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 " 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' \ @@ -1756,7 +1763,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). @@ -1768,7 +1775,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 @@ -2295,7 +2302,7 @@ _git-switch() { "(-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 @@ -2338,6 +2345,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 \ @@ -2516,6 +2524,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' \ @@ -2596,6 +2605,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' @@ -2632,6 +2642,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' @@ -2640,7 +2651,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" @@ -2761,6 +2772,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' @@ -2799,16 +2811,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 @@ -3000,6 +3019,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' @@ -3010,6 +3030,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' @@ -3898,6 +3919,7 @@ _git-pack-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]' \ + '--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]' \ @@ -3942,6 +3964,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' ) @@ -3995,6 +4018,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 @@ -4109,6 +4174,7 @@ _git-repack () { '(-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]: :_git_approxidates" \ '-f[pass --no-reuse-delta option to git pack-objects]' \ @@ -4125,11 +4191,13 @@ _git-repack () { '--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]' \ - '--expire-to=[pack prefix to store a pack containing pruned objects]:directory:_directories' + '--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] )) || @@ -4351,6 +4419,7 @@ _git-merge-tree () { '--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' @@ -4649,6 +4718,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' \ @@ -4687,6 +4757,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"' @@ -5002,6 +5073,9 @@ _git-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]' \ @@ -5117,6 +5191,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(-.)"' } @@ -5140,7 +5215,13 @@ _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"' \ + '--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' \ @@ -5353,6 +5434,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]' \ @@ -5527,6 +5609,7 @@ _git-for-each-ref () { "*--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]' \ @@ -5538,6 +5621,7 @@ _git-for-each-ref () { _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' } @@ -5590,8 +5674,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..insteadOf" config setting]' \ @@ -5717,6 +5802,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]' } @@ -5724,24 +5810,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] )) || @@ -5766,7 +5854,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(-.)"' } @@ -6312,6 +6400,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') @@ -8669,6 +8758,9 @@ _git() { '--namespace=[set the Git namespace]:namespace' \ '--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 -- cgit v1.2.3 From 8cddd97297365f91e0f816f5364e06f77b0a2358 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Wed, 3 Apr 2024 00:36:22 +0900 Subject: github #118: completion(git-rebase): non-interactive mode also supports --autosquash --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 11 ++--------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 27ae19b06..6e5689d8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2025-01-30 Oliver Kiddle + * github #118: Eisuke Kawashima: Completion/Unix/Command/_git: + git rebase non-interactive mode also supports --autosquash + * 53338: Completion/Zsh/Command/_typeset: complete typeset -n option * 53337: Doc/Zsh/mod_ksh93.yo, Src/Modules/ksh93.c: allow nameref -p diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a442b45d2..702360ef3 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1565,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]' \ @@ -1605,7 +1597,8 @@ _git-rebase () { '(--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]' \ -- cgit v1.2.3