From e4bab32e5b4a30e076d455159defcd56bc345293 Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Fri, 21 Feb 2025 21:31:00 +0900 Subject: [PATCH 1/2] Update completion scripts for Git 2.48.1 --- NEWS | 2 + NEWS.ja | 1 + share/completion/git | 81 +++- share/completion/git-add | 17 +- share/completion/git-am | 28 +- share/completion/git-annotate | 2 +- share/completion/git-apply | 16 +- share/completion/git-bisect | 7 +- share/completion/git-blame | 2 +- share/completion/git-branch | 23 +- share/completion/git-checkout | 25 +- share/completion/git-cherry | 2 +- share/completion/git-cherry-pick | 17 +- share/completion/git-clean | 5 +- share/completion/git-clone | 33 +- share/completion/git-commit | 39 +- share/completion/git-config | 715 +++++++++++++++++++++++++----- share/completion/git-describe | 11 +- share/completion/git-diff | 120 ++++- share/completion/git-diff-tree | 6 +- share/completion/git-fetch | 51 ++- share/completion/git-format-patch | 53 ++- share/completion/git-grep | 7 +- share/completion/git-init | 13 +- share/completion/git-log | 14 +- share/completion/git-ls-remote | 18 +- share/completion/git-merge | 32 +- share/completion/git-name-rev | 13 +- share/completion/git-notes | 11 +- share/completion/git-pull | 17 +- share/completion/git-push | 26 +- share/completion/git-rebase | 19 +- share/completion/git-reflog | 9 +- share/completion/git-remote | 30 +- share/completion/git-request-pull | 6 +- share/completion/git-reset | 13 +- share/completion/git-rev-list | 44 +- share/completion/git-rev-parse | 25 +- share/completion/git-revert | 9 +- share/completion/git-rm | 10 +- share/completion/git-show | 2 +- share/completion/git-show-branch | 2 +- share/completion/git-stash | 21 +- share/completion/git-status | 23 +- share/completion/git-submodule | 72 ++- share/completion/git-svn | 73 ++- share/completion/git-switch | 9 +- share/completion/git-tag | 44 +- share/completion/git-whatchanged | 30 +- share/completion/git-worktree | 132 +++++- 50 files changed, 1640 insertions(+), 340 deletions(-) diff --git a/NEWS b/NEWS index 7f9dd72b..a5da2e86 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ - The `trap` built-in now also reports signals that are ignored because the program that invoked the shell has set the signal to be ignored. + - [line-editing] Updated the completion scripts to support Git + 2.48.1. - Fixed a possible crash when the `read` built-in reads input in an interactive shell. - Added a workaround for an apparent bug in glibc's fsetpos function diff --git a/NEWS.ja b/NEWS.ja index 8c6fbce0..23dd69b6 100644 --- a/NEWS.ja +++ b/NEWS.ja @@ -8,6 +8,7 @@ も含めて全てのトラップを表示する。 - `trap` 組込みはシェルが起動された時点で最初から無視されていた シグナルも表示するようになった + - [行編集] 補完スクリプトを Git 2.48.1 相当に更新 - 対話シェルで `read` 組込みが入力を読み込む際にクラッシュすることが あったのを修正 - glibc の fsetpos 関数が正しく動作しないために履歴ファイルが更新 diff --git a/share/completion/git b/share/completion/git index 579e0d76..7bce81de 100644 --- a/share/completion/git +++ b/share/completion/git @@ -1,7 +1,7 @@ -# (C) 2011-2021 magicant +# (C) 2011-2025 magicant # Completion script for the "git" command. -# Supports Git 2.9.2. +# Supports Git 2.48.1. function completion/git { @@ -9,23 +9,29 @@ function completion/git { OPTIONS=( #># "C:; specify a directory to operate in" "c:; specify a configuration parameter" + "--attr-source:; specify the attribute file" "--bare; treat the repository as a bare repository" + "--config-env:; specify a configuration parameter from environment" "--exec-path::; specify or print the directory containing core git executables" "--git-dir:; specify the repository directory" "--glob-pathspecs; enable globbing on all path-specs" "--html-path; print the directory where HTML documentation is installed" "--icase-pathspecs; treat path-specs case-insensitively" "--info-path; print the directory where info manuals are installed" + "--list-cmds:; list commands by group" "--literal-pathspecs; treat path-specs literally" "--man-path; print the directory where manual pages are installed" "--namespace:; specify a namespace" + "--no-advice; don't print any hints" "--noglob-pathspecs; disable globbing on all path-specs" + "--no-lazy-fetch; don't fetch missing objects from remote" + "--no-optional-locks; don't do optional operations that require locks" "p --paginate; run a pager to view Git's output" - "--no-pager; don't run a pager to view Git's output" + "P --no-pager; don't run a pager to view Git's output" "--no-replace-objects; don't use replacement refs" "--work-tree:; specify the working tree directory" - "--help" - "--version" + "h --help" + "v --version" ) #<# # convert "--help" to "help" @@ -634,6 +640,14 @@ function completion/git::--author:arg { done 2>/dev/null <(git log --all --format=format:%an | uniq) } +function completion/git::--cleanup:arg { #>># + complete -P "$PREFIX" -D "like \"strip\" when editing and \"whitespace\" otherwise" default + complete -P "$PREFIX" -D "delete empty lines and lines below the cut line" scissors + complete -P "$PREFIX" -D "delete empty lines and comments" strip + complete -P "$PREFIX" -D "leave message as is" verbatim + complete -P "$PREFIX" -D "delete empty lines" whitespace +} #<<# + function completion/git::--color:arg { #>># complete -P "$PREFIX" -D "always print in color" always complete -P "$PREFIX" -D "print in color if output is terminal" auto @@ -658,13 +672,38 @@ function completion/git::--date:arg { #>># complete -P "$PREFIX" -D "print in strict ISO 8601 format" iso8601-strict complete -P "$PREFIX" -D "print in RFC 2822 format" rfc2822 complete -P "$PREFIX" -D "print in YYYY-MM-DD format" short - complete -P "$PREFIX" -D "print the raw timestamp value" raw + complete -P "$PREFIX" -D "print the raw timestamp value with offset" raw + complete -P "$PREFIX" -D "print in minimal human-readable format" human + complete -P "$PREFIX" -D "print the raw timestamp value" unix complete -P "$PREFIX" local relative-local default-local iso8601-local \ iso8601-strict-local rfc2822-local short-local raw-local complete -P "$PREFIX" -D "specify a format" -T format: } #<<# # TODO --date=format:...% +function completion/git::--empty:arg { #>># + complete -P "$PREFIX" -D 'discard redundant patches' drop + complete -P "$PREFIX" -D 'create empty commits for redundant patches' keep + complete -P "$PREFIX" -D 'pause on redundant patches' stop +} #<<# + +function completion/git::--exclude-hidden:arg { #>># + complete -P "$PREFIX" -D "fetch.hideRefs" fetch + complete -P "$PREFIX" -D "receive.hideRefs" receive + complete -P "$PREFIX" -D "uploadpack.hideRefs" uploadpack +} #<<# + +function completion/git::--filter:arg { #>># + complete -P "$PREFIX" -D "omit all blobs" blob:none + complete -P "$PREFIX" -S = -T -D "pick blobs smaller than the specified size" blob:limit + complete -P "$PREFIX" -D "pick tags only" object:type=tag + complete -P "$PREFIX" -D "pick commits only" object:type=commit + complete -P "$PREFIX" -D "pick trees only" object:type=tree + complete -P "$PREFIX" -D "pick blobs only" object:type=blob + complete -P "$PREFIX" -S = -T -D "pick blobs for sparse checkout only" sparse:oid + complete -P "$PREFIX" -S : -T -D "omit blobs deeper than the specified level" tree +} #<<# + function completion/git::--format:arg { typeset word="${TARGETWORD#"$PREFIX"}" word=${word//%%} @@ -721,6 +760,7 @@ function completion/git::--format:arg { complete -P "$PREFIX" -D "commit ID, author, date, and full log message" medium complete -P "$PREFIX" -D "commit ID, author, committer, and full log message" full complete -P "$PREFIX" -D "commit ID, author, date, committer, date, and full log message" fuller + complete -P "$PREFIX" -D "commit ID, title, and date" reference complete -P "$PREFIX" -D "imitate email" email complete -P "$PREFIX" -D "raw commit object" raw complete -P "$PREFIX" -D "specify a format (newline-separated)" -T format: @@ -733,6 +773,10 @@ function completion/git::--format:arg { esac } +function completion/git::--gpg-sign:arg { + # TODO +} + function completion/git::--ignore-submodules:arg { #>># complete -P "$PREFIX" -D "ignore all changes in submodules" all complete -P "$PREFIX" -D "ignore uncommitted changes in submodules" dirty @@ -740,6 +784,10 @@ function completion/git::--ignore-submodules:arg { #>># complete -P "$PREFIX" -D "ignore untracked files in submodules" untracked } #<<# +function completion/git::--negotiation-tip:arg { + command -f completion/git::completeref +} + function completion/git::--pretty:arg { command -f completion/git::--format:arg "$@" } @@ -755,6 +803,27 @@ function completion/git::--recurse-submodules:arg { #>># complete -P "$PREFIX" yes } #<<# +function completion/git::--ref-format:arg { #>># + complete -P "$PREFIX" files reftable +} #<<# + +function completion/git::--refmap:arg { + command -f completion/git::completeref +} + +function completion/git::--shallow-exclude:arg { + command -f completion/git::completeref +} + +function completion/git::--sort:arg { + # TODO +} + +function completion/git::--track:arg { #>># + complete -P "$PREFIX" -D "use start-point branch as upstream" direct + complete -P "$PREFIX" -D "copy remote-tracking branch from start-point branch" inherit +} #<<# + function completion/git::--untracked-files:arg { #>># complete -P "$PREFIX" -D "print all individual files in untracked directories" all complete -P "$PREFIX" -D "print untracked files and directories" normal diff --git a/share/completion/git-add b/share/completion/git-add index bc7087f6..156f51ea 100644 --- a/share/completion/git-add +++ b/share/completion/git-add @@ -1,7 +1,7 @@ -# (C) 2011-2013 magicant +# (C) 2011-2025 magicant # Completion script for the "git-add" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1 function completion/git-add { WORDS=(git add "${WORDS[2,-1]}") @@ -12,6 +12,7 @@ function completion/git::add:arg { OPTIONS=( #># "A --all; add all files including untracked files" + "--chmod:; override executable bit of added files" "n --dry-run; don't actually add files" "e --edit; edit patch hunks before adding" "f --force; add ignored files" @@ -19,8 +20,14 @@ function completion/git::add:arg { "--ignore-missing; ignore missing files (with -n)" "N --intent-to-add; add filepaths but not their contents" "i --interactive; enter the interactive mode" + "--no-all --no-ignore-removal; add only new and modified files" + "--no-warn-embedded-repo; allow adding embedded repositories" "p --patch; interactively choose patch hunks to add" + "--pathspec-file-nul; use nul as separator for pathspecs" + "--pathspec-from-file:; read pathspecs from file" "--refresh; refresh stat info in the index without adding" + "--renormalize; re-apply \"clean\" process" + "--sparse; update index outside of sparse-checkout cone" "u --update; add tracked files only; don't add new files" "v --verbose; print affected filenames" ) #<# @@ -30,6 +37,12 @@ function completion/git::add:arg { (-) command -f completion//completeoptions ;; + (--chmod) + complete -P "$PREFIX" -- -x +x + ;; + (--pathspec-from-file) + complete -P "$PREFIX" -f + ;; ('') command -f completion/git::add:opr ;; diff --git a/share/completion/git-am b/share/completion/git-am index f73b6233..51226006 100644 --- a/share/completion/git-am +++ b/share/completion/git-am @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-am" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-am { WORDS=(git am "${WORDS[2,-1]}") @@ -11,20 +11,33 @@ function completion/git-am { function completion/git::am:arg { OPTIONS=( #># - "3 --3way; try 3-way merge on conflict" + "--allow-empty; create empty commit for message without patch" "--abort; abort patching and restore the original branch" "--committer-date-is-author-date; use author date for committer date" "r --continue --resolved; commit the current index and continue patching" + "--empty:; specify how to handle messages without a patch" + "S:: --gpg-sign::; sign commits using GPG" "--ignore-date; use committer date for author date" "i --interactive" "k --keep; use the mail subject intact as the commit message" "--keep-cr; don't remove carriage returns at the end of lines" + "--keep-non-patch; keep bracketed words in subject except [PATCH]" + "m --message-id; add message-id to commit message" + "--no-3way; don't try 3-way merge on conflict" + "--no-gpg-sign; don't sign commits using GPG" "--no-keep-cr; remove carriage returns at the end of lines" + "--no-message-id; don't add message-id to commit message" "--no-scissors; cancels the --scissors OPTIONS" "--no-utf8; don't convert character encoding" + "v --no-verify; bypass pre-applypatch and applypatch-msg hooks" + "--patch-format:; specify patch format" + "--quoted-cr:; specify how to handle CR in quoted email" "q --quiet; print error messages only" + "--quit; abort patching and keep HEAD and index as is" "--resolvemsg:" # not for command line use + "--retry; re-apply last conflicting patch" "c --scissors; remove lines before a scissors line" + "--show-current-patch::; show message on conflict" "s --signoff; add a \"signed-off-by\" line to the message" "--skip; skip the current patch (when restarting an aborted patch)" "u --utf8; re-encode the log message into UTF-8" @@ -42,6 +55,15 @@ function completion/git::am:arg { ('') complete -P "$PREFIX" -f ;; + (--empty) + command -f completion/git::--empty:arg + ;; + (--patch-format) + complete -P "$PREFIX" mbox mboxrd stgit stgit-series hg + ;; + (S|--gpg-sign) + command -f completion/git::--gpg-sign:arg + ;; (*) if command -vf completion/git::apply:compopt >/dev/null 2>&1 || . -AL completion/git-apply; then diff --git a/share/completion/git-annotate b/share/completion/git-annotate index ab0550d0..13f4c1e1 100644 --- a/share/completion/git-annotate +++ b/share/completion/git-annotate @@ -1,7 +1,7 @@ # (C) 2011 magicant # Completion script for the "git-annotate" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-annotate { WORDS=(git annotate "${WORDS[2,-1]}") diff --git a/share/completion/git-apply b/share/completion/git-apply index f478c470..4fe3b268 100644 --- a/share/completion/git-apply +++ b/share/completion/git-apply @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-apply" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-apply { WORDS=(git apply "${WORDS[2,-1]}") @@ -12,21 +12,26 @@ function completion/git::apply:arg { OPTIONS=( #># "--allow-binary-replacement --binary" + "--allow-empty; accept patch with no diff" "--apply; force to apply patches" "--build-fake-ancestor:" # TODO "--cached; apply patches to the index without modifying the working tree" "--check; check if patches can be applied without errors instead of applying patches" - "--exclude:; skip files whose names match the specified pattern" "--inaccurate-eof; work around diff errors about missing newlines at end of file" - "--include:; apply to only files whose names match the specified pattern" "--index; apply patches to the index as well as the working tree" + "--intent-to-add; add filepaths but not their contents" "--no-add; apply deletions but not additions" + "--ours; resolve conflicts in favor of our version" + "q --quiet; suppress status and progress output" "--recount; ignore line counts in hunk headers" "R --reverse; patch in reverse" "--stat; print diffstat instead of applying patches" "--numstat; print a diffstat in the machine-friendly format instead of applying patches" "--summary; print summary instead of applying patches" + "--theirs; resolve conflicts in favor of their version" "--unidiff-zero; accept unified diffs without context lines" + "--union; resolve conflicts by combining both sides" + "--unsafe-paths; allow patching outside working tree" "v --verbose; report progress in detail" "z; print a null byte after each filename" ) #<# @@ -52,7 +57,10 @@ function completion/git::apply:getopt { case $1 in (am|apply) apply=true OPTIONS=("$OPTIONS" #># + "3 --3way; try 3-way merge on conflict" "--directory:; specify a directory to work in" + "--exclude:; skip files whose names match the specified pattern" + "--include:; apply to only files whose names match the specified pattern" "p:; specify the number of pathname components to strip from file names" "--reject; apply as much as possible and leave rejected hunks in *.rej file" ) #<# diff --git a/share/completion/git-bisect b/share/completion/git-bisect index 3672d0ab..3b0b0c42 100644 --- a/share/completion/git-bisect +++ b/share/completion/git-bisect @@ -1,7 +1,7 @@ -# (C) 2011-2016 magicant +# (C) 2011-2025 magicant # Completion script for the "git-bisect" command. -# Supports Git 2.9.2. +# Supports Git 2.48.1. function completion/git-bisect { WORDS=(git bisect "${WORDS[2,-1]}") @@ -25,7 +25,7 @@ function completion/git::bisect:arg { complete -P "$PREFIX" -D "mark a commit as untestable" skip complete -P "$PREFIX" -D "start bisection" start complete -P "$PREFIX" -D "show terms used in the current session" terms - complete -P "$PREFIX" -D "show remaining suspects with GUI" visualize + complete -P "$PREFIX" -D "show remaining suspects with GUI" visualize view #<<# case ${TARGETWORD#"$PREFIX"} in (vie*) complete -P "$PREFIX" -D "show remaining suspects with GUI" view @@ -80,6 +80,7 @@ function completion/git::bisect:skip:arg { function completion/git::bisect:start:arg { OPTIONS=( #># + "--first-parent; follow only first parent of merge commits" "--no-checkout; don't automatically check out commits to test" "--term-old: --term-good:; specify a term for the old state" "--term-new: --term-bad:; specify a term for the new state" diff --git a/share/completion/git-blame b/share/completion/git-blame index 062875bf..01296b6a 100644 --- a/share/completion/git-blame +++ b/share/completion/git-blame @@ -1,7 +1,7 @@ # (C) 2011 magicant # Completion script for the "git-blame" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-blame { WORDS=(git blame "${WORDS[2,-1]}") diff --git a/share/completion/git-branch b/share/completion/git-branch index 76b67263..9e0d5feb 100644 --- a/share/completion/git-branch +++ b/share/completion/git-branch @@ -1,7 +1,7 @@ -# (C) 2011-2014 magicant +# (C) 2011-2025 magicant # Completion script for the "git-branch" command. -# Supports Git 1.9.0. +# Supports Git 2.48.1. function completion/git-branch { WORDS=(git branch "${WORDS[2,-1]}") @@ -16,25 +16,35 @@ function completion/git::branch:arg { "--color::; show symbols in color" "--column::; columnize output" "--contains; show branches that contain the specified commit only" + "C; copy a branch, overwriting an existing branch" + "c --copy; copy a branch" "l --create-reflog; enable reflog for the new branch" "D; delete a branch that has not been merged" "d --delete; delete a branch" "--edit; edit the branch explanation with an editor" "f --force; overwrite an existing branch" - "--list; list branches matching the operand pattern" + "--format:; specify an output format" + "i --ignore-case; sort and filter branches case-insensitively" + "l --list; list branches matching the operand pattern" "M; rename a branch, overwriting an existing branch" "--merged; show branches that are contained in the specified commit only" "m --move; rename a branch" "--no-abbrev; print full commit IDs" "--no-color; like --color=never" "--no-column; print branches line by line" + "--no-contains; show branches that don't contain the specified commit" "--no-merged; show branches that aren't contained in the specified commit only" "--no-track; create a non-tracking branch" + "--omit-empty; don't print empty items" + "--points-at; show branches that point at the specified commit" "q --quiet; print error messages only" + "--recurse-submodules; propagate branches in submodules" "r --remotes; print or delete remote-tracking branches" "--set-upstream; like --track, but don't move HEAD" "u: --set-upstream-to:; set the upstream to the specified one" - "t --track; create a remote-tracking branch" + "--show-current; show the current branch name" + "--sort:; specify the sort order" + "t:: --track::; create a remote-tracking branch" "--unset-upstream; remove the upstream" "v --verbose; print commit ID and summary for each branch" ) #<# @@ -46,9 +56,12 @@ function completion/git::branch:arg { ;; (--abbrev) ;; - (--color|--column) + (t|--color|--column|--sort|--track) command -f completion/git::$ARGOPT:arg ;; + (--format) + #TODO + ;; (u|--set-upstream-to) command -f completion/git::completeref --remotes ;; diff --git a/share/completion/git-checkout b/share/completion/git-checkout index b4cdbbca..639b0bb4 100644 --- a/share/completion/git-checkout +++ b/share/completion/git-checkout @@ -1,7 +1,7 @@ # (C) 2011-2014 magicant # Completion script for the "git-checkout" command. -# Supports Git 2.1.2. +# Supports Git 2.48.1. function completion/git-checkout { WORDS=(git checkout "${WORDS[2,-1]}") @@ -14,18 +14,31 @@ function completion/git::checkout:arg { "B:; create or reset a new branch and check it out" "b:; create a new branch and check it out" "--conflict:; like --merge, but specify format of unmerged files" - "--detach; leave HEAD in detached head state" + "d --detach; leave HEAD in detached head state" "f --force; overwrite local changes or ignore unmerged files" + "--guess; auto-create a branch from existing remote" + "--ignore-other-worktrees; force if already checked out in another worktree" "--ignore-skip-worktree-bits; ignore sparse patterns" "l; enable reflog for the new branch" "m --merge; do 3-way merge for destination branch" + "--no-guess; don't auto-create a branch from existing remote" + "--no-overlay; remove files to match the target" + "--no-overwrite-ignore; abort if ignored files would be overwritten" + "--no-progress; don't show progress" + "--no-recurse-submodules; don't propagate checkout in submodules" "--no-track; create a non-tracking branch" "--orphan:; create a new branch with no parent" "--ours; checkout local version for unmerged files" + "--overlay; don't remove files from the index" + "--overwrite-ignore; overwrite ignored files" "p --patch; interactively choose hunks to check out" + "--pathspec-file-nul; use nul as separator for pathspecs" + "--pathspec-from-file:; read pathspecs from file" + "--progress; show progress" + "--recurse-submodules; propagate checkout in submodules" "q --quiet; print error and warning messages only" "--theirs; checkout remote version for unmerged files" - "t --track; create a tracking branch" + "t:: --track::; create a tracking branch" ) #<# command -f completion//parseoptions -n @@ -40,6 +53,12 @@ function completion/git::checkout:arg { complete -P "$PREFIX" -D "ours and theirs" merge complete -P "$PREFIX" -D "ours, theirs, and original" diff3 ;; #<<# + (--pathspec-from-file) + complete -P "$PREFIX" -f + ;; + (t|--track) + command -f completion/git::--track:arg + ;; ('') command -f completion/git::completerefpath ;; diff --git a/share/completion/git-cherry b/share/completion/git-cherry index 87b769f8..40015f61 100644 --- a/share/completion/git-cherry +++ b/share/completion/git-cherry @@ -1,7 +1,7 @@ # (C) 2011 magicant # Completion script for the "git-cherry" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-cherry { WORDS=(git cherry "${WORDS[2,-1]}") diff --git a/share/completion/git-cherry-pick b/share/completion/git-cherry-pick index bb452613..2f67b599 100644 --- a/share/completion/git-cherry-pick +++ b/share/completion/git-cherry-pick @@ -1,7 +1,7 @@ -# (C) 2011-2013 magicant +# (C) 2011-2025 magicant # Completion script for the "git-cherry-pick" command. -# Supports Git 1.8.1.4. +# Supports Git 2.48.1. function completion/git-cherry-pick { WORDS=(git cherry-pick "${WORDS[2,-1]}") @@ -14,12 +14,16 @@ function completion/git::cherry-pick:arg { "--abort; end suspended cherry-picking and restore the original state" "--allow-empty; allow commits that make no change" "--allow-empty-message" + "--cleanup:; specify the way the message is cleaned up" "--continue; resume suspended cherry-picking" "e --edit; reedit the message" + "--empty:; specify how to handle already-merged commits" "--ff; fast-forward if possible" + "S:: --gpg-sign::; sign commits using GPG" "--keep-redundant-commits; don't omit already-merged commits" "m: --mainline:; apply diffs from the nth parent" "n --no-commit; don't commit the result automatically" + "--no-gpg-sign; don't sign commits using GPG" "--quit; end suspended cherry-picking and keep the current state" "r; don't include the original commit ID in the message" "s --signoff; add a \"signed-off-by\" line to the message" @@ -33,6 +37,15 @@ function completion/git::cherry-pick:arg { (-) command -f completion//completeoptions ;; + (--cleanup) + command -f completion/git::--cleanup:arg + ;; + (--empty) + command -f completion/git::--empty:arg + ;; + (S|--gpg-sign) + command -f completion/git::--gpg-sign:arg + ;; # (m|--mainline) # ;; (X|--strategy*) diff --git a/share/completion/git-clean b/share/completion/git-clean index ec01df18..33a79bb1 100644 --- a/share/completion/git-clean +++ b/share/completion/git-clean @@ -1,7 +1,7 @@ -# (C) 2013 magicant +# (C) 2013-2025 magicant # Completion script for the "git-clean" command. -# Supports Git 1.8.1.4. +# Supports Git 2.48.1. function completion/git-clean { WORDS=(git clean "${WORDS[2,-1]}") @@ -14,6 +14,7 @@ function completion/git::clean:arg { "d; remove untracked directories" "f --force; really remove untracked files" "n --dry-run; don't actually remove files, but show what would be removed" + "i --interactive; interactively choose files to remove" "q --quiet; print error messages only" "e: --exclude:; skip files whose names match the specified pattern" "X; remove ignored files only" diff --git a/share/completion/git-clone b/share/completion/git-clone index 8ea22ee9..539b0e56 100644 --- a/share/completion/git-clone +++ b/share/completion/git-clone @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-clone" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-clone { WORDS=(git clone "${WORDS[2,-1]}") @@ -11,21 +11,41 @@ function completion/git-clone { function completion/git::clone:arg { OPTIONS=( #># + "--also-filter-submodules" "--bare; clone as a bare repository" "b: --branch:; specify a branch to be the new repository's HEAD" + "--bundle-uri:; specify a bundle file to fetch objects from" "c: --config:; specify a config variable for the new repository" "--depth:; specify the max number of history to clone" + "--dissociate; stop borrowing objects after cloning" + "--filter:; specify a filter for initial transfer" + "j: --jobs:; specify the number of submodules to fetch in parallel" "l --local; optimize local clone" "--mirror; clone as a mirror repository" "n --no-checkout; don't check out HEAD automatically" "--no-hardlinks; don't use hard links to spare disk space for local clone" + "--no-reject-shallow; allow cloning a shallow repository" + "--no-remote-submodules; checkout submodules to the commit recorded in the superproject" + "--no-single-branch; clone all branches" + "--no-shallow-submodules; fully clone submodules" + "--no-tags; don't clone tags" "o: --origin:; specify a name for the source repository to set as a remote repository" "--progress; report progress" "q --quiet; don't report progress" - "--recursive --recurse-submodules; initialize submodules recursively" + "--recursive:: --recurse-submodules::; initialize submodules recursively" "--reference:; specify a reference repository to share objects (possibly dangerous operation)" + "--reference-if-able:; specify a reference repository to share objects if possible" + "--ref-format:; specify a ref storage format" + "--reject-shallow; don't clone a shallow repository" + "--remote-submodules; update submodules from the remote repository" "--separate-git-dir:; specify a directory where the new repository is located" + "--server-option:; specify an option for the git server" + "--shallow-exclude:; specify a revision to exclude from shallow cloning" + "--shallow-since:; specify a date to start shallow cloning" + "--shallow-submodules; initialize submodules in shallow cloning" "s --shared; share objects in repositories (possibly dangerous operation)" + "--single-branch; clone only one branch" + "--sparse; only checkout files in the root directory" "--template:; specify a directory that contains templates" "u: --upload-pack:; specify a path for git-upload-pack on the remote host" "v --verbose" # TODO description @@ -36,6 +56,9 @@ function completion/git::clone:arg { (-) command -f completion//completeoptions ;; + (--filter|--ref-format) + command -f "completion/git::$ARGOPT:arg" + ;; # (b|--branch) # ;; (c|--config) @@ -48,7 +71,9 @@ function completion/git::clone:arg { # ;; # (o|--origin) # ;; - (u|--reference|--template|--separate-git-dir|--upload-pack) +# (--shallow-since) +# ;; + (u|--reference|--reference-if-able|--template|--separate-git-dir|--upload-pack) complete -P "$PREFIX" -S / -T -d ;; ('') diff --git a/share/completion/git-commit b/share/completion/git-commit index 8586961e..4a117c05 100644 --- a/share/completion/git-commit +++ b/share/completion/git-commit @@ -1,7 +1,7 @@ -# (C) 2011-2012 magicant +# (C) 2011-2025 magicant # Completion script for the "git-commit" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-commit { WORDS=(git commit "${WORDS[2,-1]}") @@ -16,19 +16,27 @@ function completion/git::commit:arg { "--allow-empty-message" "--amend; redo the last commit on the current branch" "--author:; specify the author" + "--branch; show the branch name (with --short)" "--cleanup:; specify the way the message is cleaned up" "--date:; specify the date" "--dry-run; don't actually commit, but show what would happen" "e --edit; reedit the message" "F: --file:; specify a file containing the message" "--fixup:; prepare the message to fix up the specified commit in later autosquash" + "S:: --gpg-sign::; sign commits using GPG" "i --include; include operand files in the commit" + "--long; dry-run with the long output format" "m: --message:; specify the message" "--no-edit; don't reedit the message" + "--no-gpg-sign; don't sign commits using GPG" + "--no-post-rewrite; bypass the post-rewrite hook" + "--no-signoff; don't add a \"signed-off-by\" line to the message" "--no-status; don't include file statuses in the message template" "n --no-verify; bypass the pre-commit and commit-msg hooks" "o --only; commit operand files only" "p --patch; interactive choose patch hunks to commit" + "--pathspec-file-nul; use nul as separator for pathspecs" + "--pathspec-from-file:; read pathspecs from file" "--porcelain; dry-run with the machine-friendly format" "q --quiet; suppress the commit summary message" "--reset-author; ignore the date and author of the original commit" @@ -39,9 +47,10 @@ function completion/git::commit:arg { "--squash:; prepare the message to squash the specified commit in later autosquash" "--status; include file statuses in the message template" "t: --template:; specify a file containing a template message to edit" + "--trailer:; specify token-value pair to append to the message" "u:: --untracked-files::; print untracked files" "v --verbose; include diffs in the message template" - "z; print a null byte after each filename" + "z --null; print a null byte after each filename" ) #<# command -f completion//parseoptions -n @@ -52,21 +61,31 @@ function completion/git::commit:arg { (--author) command -f completion/git::--author:arg ;; - (--cleanup) #>># - complete -P "$PREFIX" -D "like \"strip\" when editing and \"whitespace\" otherwise" default - complete -P "$PREFIX" -D "delete empty lines and comments" strip - complete -P "$PREFIX" -D "don't clean up the message at all" verbatim - complete -P "$PREFIX" -D "delete empty lines" whitespace - ;; #<<# + (--cleanup) + command -f completion/git::--cleanup:arg + ;; # (--date) # TODO complete date # ;; - ([Ft]|--file|--template) + ([Ft]|--file|--pathspec-from-file|--template) complete -P "$PREFIX" -f ;; + (--fixup) #>># + complete -P "$PREFIX" -D "prepare for later amend" -T amend: + complete -P "$PREFIX" -D "prepare for later amend with explicitly specified files" -T reword: + #<<# + case "${TARGETWORD#"$PREFIX"}" in + (amend:*) PREFIX=${PREFIX}amend: ;; + (reword:*) PREFIX=${PREFIX}reword: ;; + esac + command -f completion/git::completeref + ;; ([Cc]|--fixup|--reuse-message|--reedit-message|--squash) command -f completion/git::completeref ;; + (S|--gpg-sign) + command -f completion/git::--gpg-sign:arg + ;; (u|--untracked-files) command -f completion/git::--untracked-files:arg ;; diff --git a/share/completion/git-config b/share/completion/git-config index de61148b..0ef8210a 100644 --- a/share/completion/git-config +++ b/share/completion/git-config @@ -1,7 +1,7 @@ -# (C) 2011-2024 magicant +# (C) 2011-2025 magicant # Completion script for the "git-config" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-config { WORDS=(git config "${WORDS[2,-1]}") @@ -12,37 +12,84 @@ function completion/git::config:arg { OPTIONS=( #># "--add; add a new line to the option value" + "--blob:; specify an object to save config" "--bool; ensure the option value is a boolean" "--bool-or-int; ensure the option value is a boolean or integer" + "--default:; specify a default to show if the option is not set" "e --edit; start an editor to edit the config file" + "--expiry-date; expand the date value to a timestamp" "f: --file:; specify the config file path" - "--get; print an option value" - "--get-all; print one or more option values" - "--get-color; print ANSI color escape sequence" + "--get; show an option value" + "--get-all; show all values for an option" + "--get-color; show ANSI color escape sequence" "--get-colorbool; check if output should be colored" - "--get-regexp; print options whose keys match the specified regular expression" + "--get-regexp; show options whose keys match the specified regular expression" + "--get-urlmatch; show option with a key matching the specified URL" "--global; get or set the global options" + "--includes; apply include.* directives" "--int; ensure the option value is an integer" - "l --list; print all options set" + "l --list; show all options set" + "--local; get or set the repository-specific options" + "--name-only; show only the names of options" + "--no-includes; do not apply include.* directives" + "--no-type; do not canonicalize values" "z --null; print a null byte after each key-value pair" "--path; perform tilde expansion when printing option values" "--remove-section; remove a section" "--rename-section; rename a section" "--replace-all; replace all matching values" + "--show-origin; show options with their specifying file" + "--show-scope; show options with their scope" "--system; get or set the system-wide options" + "--type:; canonicalize values under specified constraint" "--unset; remove (part of) an option" "--unset-all; remove (all matching parts of) an option" + "--worktree; get or set the worktree-specific options" ) #<# - command -f completion//parseoptions -n + command -f completion//parseoptions -es case $ARGOPT in (-) + command -f completion//getoperands + case "${WORDS[1]}" in ([gs]et|unset) + OPTIONS=("$OPTIONS" #># + "--all; operate on all values of multi-valued options" + "--value:; specify the option value to operate on" + "--fixed-value; match the option value exactly (with --value)" + ) #<# + esac + case "${WORDS[1]}" in + (get) + OPTIONS=("$OPTIONS" #># + "--regexp; show options whose keys match the specified regular expression" + "--url:; show option with a section name matching the specified URL" + ) #<# + ;; + (set) + OPTIONS=("$OPTIONS" #># + "--append; add a new value to a multi-valued option" + ) #<# + ;; + esac command -f completion//completeoptions ;; (f|--file) complete -P "$PREFIX" -f ;; + (--type) + complete -P "$PREFIX" bool int bool-or-int path expiry-date color + ;; ('') + command -f completion//getoperands + if [ "${WORDS[#]}" -eq 0 ]; then #>># + complete -P "$PREFIX" -D "modify value with an editor" edit + complete -P "$PREFIX" -D "show value for specific key" get + complete -P "$PREFIX" -D "show all key-value pairs" list + complete -P "$PREFIX" -D "rename group of keys" rename-section + complete -P "$PREFIX" -D "remove group of keys" remove-section + complete -P "$PREFIX" -D "set value for specific key" set + complete -P "$PREFIX" -D "remove value for specific key" unset + fi #<<# command -f completion//git::completeoptionname ;; esac @@ -85,8 +132,24 @@ function completion//git::completeoptionname { (advice.*) PREFIX=${PREFIX}advice. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - commitBeforeMerge detachedHead implicitIdentity\ - pushNonFastForward resolveConflict statusHints + addEmbeddedRepo addEmbeddedRepo addIgnoredFile \ + amWorkDir ambiguousFetchRefspec \ + checkoutAmbiguousRemoteBranchName \ + commitBeforeMerge detachedHead diverging \ + fetchShowForcedUpdates forceDeleteBranch \ + ignoredHook implicitIdentity mergeConflict \ + nestedTag pushAlreadyExists pushFetchFirst \ + pushNeedsForce pushNonFFCurrent \ + pushNonFFMatching pushRefNeedsUpdate \ + pushUnqualifiedRefname pushUpdateRejected \ + rebaseTodoError refSyntax resetNoRefresh \ + resolveConflict rmHints sequencerInUse \ + skippedCherryPicks sparseIndexExpanded \ + statusAheadBehind statusHints statusUoption \ + submoduleAlternateErrorStrategyDie \ + submoduleMergeConflict submodulesNotUpdated \ + suggestDetachingHead updateSparsePath \ + waitingForEditor worktreeAddOrphan ;; #<<# (alias.*) PREFIX=${PREFIX}alias. #>># @@ -95,23 +158,49 @@ function completion//git::completeoptionname { (am.*) PREFIX=${PREFIX}am. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - keepcr + keepcr threeWay ;; #<<# (apply.*) PREFIX=${PREFIX}apply. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ ignorewhitespace whitespace ;; #<<# + (attr.*) + PREFIX=${PREFIX}attr. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + tree + ;; #<<# + (author.*|committer.*) + word=${word#*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + email name + ;; #<<# + (bitmapPseudoMerge.*.*) + word=${word#bitmapPseudoMerge.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + pattern decay sampleRate threshold maxMerges \ + stableThreshold stableSize + ;; #<<# + (blame.*) + PREFIX=${PREFIX}blame. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + blankBoundary coloring date showEmail showRoot \ + ignoreRevsFile markUnblamableLines \ + markIgnoredLines + ;; #<<# (branch.*.*) word=${word#branch.*.} PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - merge mergeoptions rebase remote + remote pushRemote merge mergeOptions rebase \ + description ;; #<<# (branch.*) PREFIX=${PREFIX}branch. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - autosetupmerge autosetuprebase + autoSetupMerge autoSetupRebase sort #<<# command -f completion/git::completeref \ abbrprefixes=refs/heads/ dontcompletefull=true \ @@ -123,11 +212,33 @@ function completion//git::completeoptionname { complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ cmd path ;; #<<# + # (bundle.*) not yet supported + (checkout.*) + PREFIX=${PREFIX}checkout. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + defaultRemote guess workers \ + thresholdForParallelism + ;; #<<# (clean.*) PREFIX=${PREFIX}clean. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ requireForce ;; #<<# + (clone.*) + PREFIX=${PREFIX}clone. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + defaultRemoteName rejectShallow filterSubmodules + ;; #<<# + (color.advice.*) + PREFIX=${PREFIX}color.advice. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + hint + ;; #<<# + (color.blame.*) + PREFIX=${PREFIX}color.blame. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + highlightRecent repeatedLines + ;; #<<# (color.branch.*) PREFIX=${PREFIX}color.branch. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ @@ -136,91 +247,181 @@ function completion//git::completeoptionname { (color.diff.*) PREFIX=${PREFIX}color.diff. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - commit frag func meta new old plain whitespace + context contextBold contextDimmed commit frag \ + func meta new newBold newDimmed newMoved \ + newMovedDimmed newMovedAlternative \ + newMovedAlternativeDimmed old oldBold oldDimmed\ + oldMoved oldMovedDimmed oldMovedAlternative \ + oldMovedAlternativeDimmed plain whitespace ;; #<<# (color.decorate.*) PREFIX=${PREFIX}color.decorate. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - branch HEAD remoteBranch stash tag + branch HEAD remoteBranch stash tag grafted ;; #<<# (color.grep.*) PREFIX=${PREFIX}color.grep. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - context filename function linenumber match \ - selected separator + context filename function lineNumber column \ + match matchContext matchSelected selected \ + separator ;; #<<# (color.interactive.*) PREFIX=${PREFIX}color.interactive. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ error header help prompt ;; #<<# + (color.push.*) + PREFIX=${PREFIX}color.push. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + error + ;; #<<# + (color.remote.*) + PREFIX=${PREFIX}color.remote. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + error hint success warning + ;; #<<# (color.status.*) PREFIX=${PREFIX}color.status. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - added branch changed header nobranch untracked \ - updated + added branch changed header localBranch \ + nobranch remoteBranch unmerged untracked updated + ;; #<<# + (color.transport.*) + PREFIX=${PREFIX}color.transport. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + rejected ;; #<<# (color.*) PREFIX=${PREFIX}color. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - branch diff grep interactive pager showbranch \ - status ui - #<<# + advice branch diff grep interactive pager push \ + remote showBranch status transport ui complete -P "$PREFIX" -S . -T -- \ - branch diff decorate grep interactive status - ;; + advice blame branch diff decorate grep \ + interactive push status transport + ;; #<<# + (column.*) + PREFIX=${PREFIX}column. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + ui branch clean status tag + ;; #<<# (commit.*) PREFIX=${PREFIX}commit. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - status template + cleanup gpgSign status template verbose + ;; #<<# + (commitGraph.*) + PREFIX=${PREFIX}commitGraph. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + generationVersion maxNewFilters \ + readChangedPaths changedPathsVersion + ;; #<<# + (completion.*) + PREFIX=${PREFIX}completion. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + commands ;; #<<# (core.*) PREFIX=${PREFIX}core. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - abbrev askpass attributesfile autocrlf bare \ - bigFileThreshold compression createObject \ - deltaBaseCacheLimit editor eol excludesfile \ - fileMode fsyncobjectfiles gitProxy \ + abbrev alternateRefsCommand \ + alternateRefsPrefixes askPass attributesFile \ + autocrlf bare bigFileThreshold \ + checkRoundtripEncoding checkStat commentChar \ + commentString commitGraph compression \ + createObject deltaBaseCacheLimit editor eol \ + excludesFile fileMode filesRefLockTimeout \ + fsmonitor fsmonitorHookVersion fsync \ + fsyncMethod fsyncObjectFiles gitProxy \ + hideDotFiles hooksPath ignoreCase \ ignoreCygwinFSTricks ignoreStat ignorecase \ - logAllRefUpdates loosecompression notesRef \ - packedGitLimit packedGitWindowSize pager \ - preferSymlinkRefs preloadindex quotepath \ - repositoryFormatVersion safecrlf \ - sharedRepository sparseCheckout symlinks \ - trustctime warnAmbiguousRefs whitespace \ + logAllRefUpdates looseCompression maxTreeDepth \ + multiPackIndex notesRef packedGitLimit \ + packedGitWindowSize packedRefsTimeout pager \ + precomposeUnicode preferSymlinkRefs \ + preloadIndex protectHFS quotePath \ + repositoryFormatVersion \ + restrictinheritedhandles safecrlf \ + sharedRepository sparseCheckout \ + sparseCheckoutCone splitIndex sshCommand \ + symlinks trustctime unsetenvvars untrackedCache\ + useReplaceRefs warnAmbiguousRefs whitespace \ worktree ;; #<<# + (credential.*) + word=${word#credential.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + helper interactive useHttpPath sanitizePrompt \ + protectProtocol username + ;; #<<# + (credentialCache.*) + PREFIX=${PREFIX}credentialCache. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + ignoreSIGHUP + ;; #<<# + (credentialStore.*) + PREFIX=${PREFIX}credentialStore. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + lockTimeoutMS + ;; #<<# (diff.*.*) word=${word#diff.*.} PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ binary cachetextconv command textconv \ - wordregex xfuncname + trustExitCode wordregex xfuncname ;; #<<# (diff.*) PREFIX=${PREFIX}diff. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - autorefreshindex dirstat external \ - ignoreSubmodules mnemonicprefix noprefix \ - renameLimit renames suppressBlankEmpty tool \ - wordRegex + algorithm autoRefreshIndex colorMoved \ + colorMovedWS context dirstat dstPrefix external\ + guitool ignoreSubmodules indentHeuristic \ + interHunkContext mnemonicPrefix noPrefix \ + orderFile relative renameLimit renames \ + srcPrefix statGraphWidth statNameWidth \ + submodule suppressBlankEmpty tool trustExitCode\ + wordRegex wsErrorHighlight ;; #<<# # (difftool.*.*) -> (browser.*.*) (difftool.*) PREFIX=${PREFIX}difftool. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - prompt + guiDefault prompt trustExitCode ;; #<<# - (fetch.*) - PREFIX=${PREFIX}fetch. #>># + (extensions.*) + PREFIX=${PREFIX}extensions. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - recurseSubmodules unpackLimit + compatObjectFormat noop noop-v1 objectFormat \ + partialClone preciousObjects refStorage \ + relativeWorktrees worktreeConfig ;; #<<# - (format.*) - PREFIX=${PREFIX}format. #>># + (fastimport.*) + PREFIX=${PREFIX}fastimport. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + unpackLimit + ;; #<<# + (feature.*) + PREFIX=${PREFIX}feature. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - attach cc numbered headers pretty signature \ - signoff subjectprefix suffix thread to + experimental manyFiles + ;; #<<# + (fetch.fsck.*|fsck.*|receive.fsck.*) + word=${word#*fsck.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + skipList # TODO msg-id + ;; #<<# + (fetch.*) + PREFIX=${PREFIX}fetch. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + all bundleURI bundleCreationToken fsckObjects \ + negotiationAlgorithm output parallel prune \ + pruneTags recurseSubmodules showForcedUpdates \ + unpackLimit writeCommitGraph + complete -P "$PREFIX" -S . -T -- fsck ;; #<<# (filter.*.*) word=${word#filter.*.} @@ -228,61 +429,115 @@ function completion//git::completeoptionname { complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ clean smudge ;; #<<# + (format.*) + PREFIX=${PREFIX}format. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + attach cc coverFromDescription coverLetter \ + encodeEmailHeaders filenameMaxLength \ + forceInBodyFrom from mboxrd noprefix notes \ + numbered headers outputDirectory pretty \ + signature signatureFile signOff subjectPrefix \ + suffix thread to useAutoBase + ;; #<<# + # (fsck.*) -> (fetch.fsck.*) + (fsmonitor.*) + PREFIX=${PREFIX}fsmonitor. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allowRemote socketDir + ;; #<<# (gc.*.*) word=${word#gc.*.} PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - reflogexpire reflogexpireunreachable + reflogExpire reflogExpireUnreachable ;; #<<# (gc.*) PREFIX=${PREFIX}gc. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - aggressiveWindow auto autopacklimit packrefs \ - pruneexpire reflogexpire \ - reflogexpireunreachable \ - rerereresolved rerereunresolved + aggressiveDepth aggressiveWindow auto \ + autoDetach autoPackLimit bigPackThreshold \ + cruftPacks logExpiry maxCruftSize packRefs \ + pruneExpire recentObjectsHook reflogExpire \ + reflogExpireUnreachable repackFilter \ + repackFilterTo rerereResolved rerereUnresolved \ + worktreePruneExpire writeCommitGraph ;; #<<# (gitcvs.*) PREFIX=${PREFIX}gitcvs. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - allbinary commitmsgannotation \ - dbTableNamePrefix dbdriver dbname dbpass \ - dbuser enabled logfile usecrlfattr + allBinary commitMsgAnnotation \ + dbTableNamePrefix dbDriver dbName dbPass \ + dbUser enabled logFile usecrlfattr + ;; #<<# + (gitweb.*) + PREFIX=${PREFIX}gitweb. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + category description owner url + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + avatar blame grep highlight patches pickaxe \ + remote_heads showSizes snapshot + ;; #<<# + (gpg.ssh.*) + word=${word#gpg.ssh.*} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allowedSignersFile defaultKeyCommand program \ + revocationFile ;; #<<# + (gpg.*.*) + word=${word#gpg.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + program + ;; #<<# + (gpg.*) + PREFIX=${PREFIX}gpg. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + format minTrustLevel program + complete -P "$PREFIX" -S . -T -- openpgp ssh x509 + ;; #>># (grep.*) PREFIX=${PREFIX}grep. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - extendedRegexp lineNumber + column extendedRegexp fallbackToNoIndex \ + fullName lineNumber patternType threads ;; #<<# (gui.*) PREFIX=${PREFIX}gui. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - blamehistoryctx commitmsgwidth \ - copyblamethreshold diffcontext encoding \ - fastcopyblame matchtrackingbranch \ - newbranchtemplate pruneduringfetch \ - spellingdictionary trustmtime + blamehistoryctx commitMsgWidth \ + copyBlameThreshold diffContext displayUntracked\ + encoding fastCopyBlame matchTrackingBranch \ + newBranchTemplate pruneDuringFetch \ + spellingDictionary trustmtime ;; #<<# (guitool.*.*) word=${word#guitool.*.} PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - argropmpt cmd confirm needsfile noconsole \ - norescan prompt revprompt revunmerged title + argPrompt cmd confirm needsFile noConsole \ + noRescan prompt revPrompt revUnmerged title ;; #<<# (help.*) PREFIX=${PREFIX}help. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - autocorrect browser format + autoCorrect browser format htmlPath ;; #<<# (http.*) - PREFIX=${PREFIX}http. #>># + word=${word##*.} + PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - cookiefile lowSpeedLimit lowSpeedTime \ - maxRequests minSessions noEPSV postBuffer \ - proxy sslCAInfo sslCAPath sslCert \ - sslCertPasswordProtected sslKey sslVerify \ - useragent + cookieFile curloptResolve delegation emptyAuth \ + extraHeader followRedirects lowSpeedLimit \ + lowSpeedTime maxRequests minSessions noEPSV \ + pinnedPubkey postBuffer proactiveAuth proxy \ + proxyAuthMethod proxySSLCAInfo proxySSLCert \ + proxySSLCertPasswordProtected proxySSLKey \ + saveCookies schannelCheckRevoke \ + schannelUseSSLCAInfo sslBackend sslCAInfo \ + sslCAPath sslCert sslCertPasswordProtected \ + sslCipherList sslKey sslTry sslVerify \ + sslVersion userAgent version ;; #<<# (i18n.*) PREFIX=${PREFIX}i18n. #>># @@ -295,10 +550,28 @@ function completion//git::completeoptionname { authMethod folder host pass port \ preformattedHTML sslverify tunnel user ;; #<<# + (include.*) + PREFIX=${PREFIX}include. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + path + ;; #<<# + (includeIf.*.*) + word=${word#includeIf.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + path + ;; #<<# + (index.*) + PREFIX=${PREFIX}index. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + recordEndOfIndexEntries recordOffsetTable \ + skipHash sparse threads version + ;; #<<# (init.*) PREFIX=${PREFIX}init. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - templatedir + defaultBranch defaultObjectFormat \ + defaultRefFormat templateDir ;; #<<# (instaweb.*) PREFIX=${PREFIX}instaweb. #>># @@ -308,17 +581,45 @@ function completion//git::completeoptionname { (interactive.*) PREFIX=${PREFIX}interactive. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - singlekey + diffFilter singleKey ;; #<<# (log.*) PREFIX=${PREFIX}log. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - abbrevCommit date decorate showroot + abbrevCommit date decorate diffMerges \ + excludeDecoration follow graphColors \ + initialDecorationSet mailmap showRoot \ + showSignature + ;; #<<# + (lsrefs.*) + PREFIX=${PREFIX}lsrefs. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + unborn ;; #<<# - (mailmap.*) - PREFIX=${PREFIX}mailmap. #>># + (mailinfo.*) + PREFIX=${PREFIX}mailinfo. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - file + scissors + ;; #<<# + (mailmap.*|sendemail.mailmap.*|sendemail.*.mailmap.*) + word=${word#*mailmap.*} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + blob file + ;; #<<# + (maintenance.*.*) + word=${word#maintenance.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + auto enabled schedule + ;; #<<# + (maintenance.*) + PREFIX=${PREFIX}maintenance. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + auto autoDetach strategy + complete -P "$PREFIX" -S . -T -- \ + commit-graph prefetch gc loose-objects \ + incremental-repack pack-refs ;; #<<# # (man.*.*) -> (browser.*.*) (man.*) @@ -335,73 +636,147 @@ function completion//git::completeoptionname { (merge.*) PREFIX=${PREFIX}merge. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - conflictstyle defaultToUpstream ff log \ - renameLimit renormalize stat tool verbosity + autoStash branchdesc conflictStyle \ + defaultToUpstream directoryRenames ff guitool \ + log renameLimit renames renormalize stat \ + suppressDest tool verbosity verifySignatures ;; #<<# (mergetool.*.*) word=${word#mergetool.*.} PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - cmd path trustExitCode + cmd hasOutput hideResolved layout path \ + trustExitCode useAutoMerge ;; #<<# (mergetool.*) PREFIX=${PREFIX}mergetool. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - keepBackup keepTemporaries prompt + guiDefault hideResolved keepBackup \ + keepTemporaries prompt writeToTemp + ;; #<<# + (notes.rewrite.*) + PREFIX=${PREFIX}notes.rewrite. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + amend rebase + ;; #<<# + (notes.*.*) + word=${word#notes.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + mergeStrategy ;; #<<# (notes.*) PREFIX=${PREFIX}notes. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - displayRef rewriteMode rewriteRef + displayRef mergeStrategy rewriteMode rewriteRef complete -P "$PREFIX" -S . -T -- rewrite - ;; #<<# + #<<# + command -f completion/git::completeref \ + abbrprefixes=refs/notes/ dontcompletefull=true \ + suffix=. --glob=refs/notes/\* + ;; (pack.*) PREFIX=${PREFIX}pack. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - compression deltaCacheLimit deltaCacheSize \ - depth indexVersion packSizeLimit threads \ - window windowMemory + allowPackReuse compression deltaCacheLimit \ + deltaCacheSize depth indexVersion island \ + islandCore packSizeLimit preferBitmapTips \ + readReverseIndex threads useBitmaps \ + useBitmapBoundaryTraversal useSparse window \ + windowMemory writeBitmaps writeBitmapHashCache \ + writeBitmapLookupTable writeReverseIndex + ;; #<<# + (pager.*) + PREFIX=${PREFIX}pager. + command -f completion/git::completecmd + ;; + (promisor.*) + PREFIX=${PREFIX}promisor. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + quiet + ;; #<<# + (protocol.*.*) + word=${word#protocol.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allow + ;; #<<# + (protocol.*) + PREFIX=${PREFIX}protocol. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allow version + complete -P "$PREFIX" -S . -T -- file git ssh http ;; #<<# (pull.*) PREFIX=${PREFIX}pull. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - octopus twohead + ff octopus rebase twohead ;; #<<# (push.*) PREFIX=${PREFIX}push. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - default + autoSetupRemote default followTags gpgSign \ + negotiate pushOption recurseSubmodules \ + useBitmaps useForceIfIncludes ;; #<<# (rebase.*) PREFIX=${PREFIX}rebase. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - autosquash stat + abbreviateCommands autoSquash autoStash backend\ + forkPoint instructionFormat maxLabelLength \ + missingCommitsCheck rebaseMerges \ + rescheduleFailedExec stat updateRefs ;; #<<# + # (receive.fsck.*) -> (fetch.fsck.*) (receive.*) PREFIX=${PREFIX}receive. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - autogc denyCurrentBranch denyDeleteCurrent \ - denyDeletes denyNonFastForwards fsckObjects \ - unpackLimit updateserverinfo + advertiseAtomic advertisePushOptions autogc \ + certNonceSeed certNonceSlop denyCurrentBranch \ + denyDeleteCurrent denyDeletes \ + denyNonFastForwards fsckObjects hideRefs \ + keepAlive maxInputSize procReceiveRefs \ + shallowUpdate unpackLimit updateServerInfo ;; #<<# + (reftable.*) + PREFIX=${PREFIX}reftable. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + blockSize geometricFactor indexObjects \ + lockTimeout restartInterval (remote.*.*) word=${word#remote.*.} PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - fetch mirror proxy push pushurl receivepack \ - skipDefaultUpdate skipFetchAll tagopt \ - uploadpack url vcs + fetch followRemoteHEAD mirror \ + partialclonefilter promisor proxy \ + proxyAuthMethod prune pruneTags push pushurl \ + receivepack serverOption skipDefaultUpdate \ + skipFetchAll tagOpt uploadpack url vcs + ;; #<<# + (remote.*) + PREFIX=${PREFIX}remote. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + pushDefault ;; #<<# (repack.*) PREFIX=${PREFIX}repack. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - usedeltabaseoffset + cruftDepth cruftThreads cruftWindow \ + cruftWindowMemory packKeptObjects \ + updateServerInfo useDeltaBaseOffset \ + useDeltaIslands writeBitmaps ;; #<<# (rerere.*) PREFIX=${PREFIX}rerere. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - autoupdate enabled + autoUpdate enabled + ;; #<<# + (safe.*) + PREFIX=${PREFIX}safe. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + bareRepository directory ;; #<<# + # (sendemail.mailmap.*|sendemail.*.mailmap.*) -> (mailmap.*) (sendemail.*.*) word=${word#sendemail.*.} PREFIX=${TARGETWORD%"$word"} @@ -410,22 +785,60 @@ function completion//git::completeoptionname { (sendemail.*) PREFIX=${PREFIX}sendemail. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - identity smtpencryption + identity smtpEncryption smtpSSLCertPath #<<# command -f completion//git::completesendemailoptionname ;; + (sequence.*) + PREFIX=${PREFIX}sequence. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + editor + ;; #<<# + (showBranch.*) + PREFIX=${PREFIX}showBranch. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + default + ;; #<<# + (sparse.*) + PREFIX=${PREFIX}sparse. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + expectFilesOutsideOfPatterns + ;; #<<# + (splitIndex.*) + PREFIX=${PREFIX}splitIndex. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + maxPercentChange sharedIndexExpire + ;; #<<# + (ssh.*) + PREFIX=${PREFIX}ssh. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + variant + ;; #<<# + (stash.*) + PREFIX=${PREFIX}stash. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + showIncludeUntracked showPatch showStat + ;; #<<# (status.*) PREFIX=${PREFIX}status. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - relativePaths showUntrackedFiles \ - submodulesummary + aheadBehind branch displayCommentPrefix \ + relativePaths renameLimit renames short \ + showStash showUntrackedFiles submoduleSummary ;; #<<# (submodule.*.*) word=${word#submodule.*.} PREFIX=${TARGETWORD%"$word"} #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + active \ fetchRecurseSubmodules ignore path update url ;; #<<# + (submodule.*) + PREFIX=${PREFIX}submodule. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + active alternateErrorStrategy alternateLocation\ + fetchJobs propagateBranches recurse + ;; #<<# (svn-remote.*.*) word=${word#svn-remote.*.} PREFIX=${TARGETWORD%"$word"} #>># @@ -443,16 +856,63 @@ function completion//git::completeoptionname { repack repackflags rmdir useSvmProps \ useSvnsyncprops ;; #<<# + (tag.*) + PREFIX=${PREFIX}tag. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + forceSignAnnotated gpgSign sort + ;; #<<# (tar.*) PREFIX=${PREFIX}tar. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ umask ;; #<<# + (trace2.*) + PREFIX=${PREFIX}trace2. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + configParams destinationDebug envVars \ + eventBrief eventNesting eventTarget maxFiles \ + normalBrief normalTarget perfBrief perfTarget + ;; #<<# (transfer.*) PREFIX=${PREFIX}transfer. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + advertiseObjectInfo advertiseSID bundleURI \ + credentialsInUrl fsckObjects hideRefs \ unpackLimit ;; #<<# + (uploadarchive.*) + PREFIX=${PREFIX}uploadarchive. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allowUnreachable + ;; #<<# + (uploadpack.*) + PREFIX=${PREFIX}uploadpack. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allowAnySHA1InWant allowFilter \ + allowReachableSHA1InWant allowRefInWant \ + allowTipSHA1InWant hideRefs keepAlive \ + packObjectsHook + ;; #<<# + (uploadpackfilter.tree.*) + word=${word#uploadpackfilter.tree.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allow maxDepth + ;; #<<# + (uploadpackfilter.*.*) + word=${word#uploadpackfilter.*.} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allow + ;; #<<# + (uploadpackfilter.*) + PREFIX=${PREFIX}uploadpackfilter. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + allow + complete -P "$PREFIX" -S . -T -- tree \ + blob:none blob:limit combine object:type \ + sparse:oid tree + ;; #<<# (url.*.*) word=${word#url.*.} PREFIX=${TARGETWORD%"$word"} #>># @@ -462,36 +922,57 @@ function completion//git::completeoptionname { (user.*) PREFIX=${PREFIX}user. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - email name signingkey + email name signingkey useConfigOnly + ;; #<<# + (versionsort.*) + PREFIX=${PREFIX}versionsort. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + suffix ;; #<<# (web.*) PREFIX=${PREFIX}web. #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ browser ;; #<<# + (worktree.*) + PREFIX=${PREFIX}worktree. #>># + complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ + guessRemote useRelativePaths + ;; #<<# (*) #>># complete -P "$PREFIX" -S . -T -- \ - add advice alias am apply branch browser clean \ - color commit core diff difftool fetch format \ - filter gc gitcvs grep gui guitool help http \ - i18n imap init instaweb interactive log \ - mailmap man merge mergetool notes pack pager \ - pretty pull push rebase receive remote remotes \ - repack rerere sendemail showbranch status \ - submodule svn svn-remote tar transfer url user \ - web + add advice alias am apply attr author \ + bitmapPseudoMerge blame branch browser bundle \ + checkout clean clone color column commit \ + commitGraph committer completion core \ + credential credentialCache credentialStore \ + diff difftool extensions fastimport feature \ + fetch format filter fsck fsmonitor gc gitcvs \ + gitweb gpg grep gui guitool help http \ + i18n imap include includeIf index init instaweb\ + interactive log lsrefs mailinfo mailmap man \ + merge mergetool notes pack pager pretty \ + promisor protocol pull push rebase receive \ + reftable remote remotes repack rerere safe \ + sendemail sequence showBranch sparse splitIndex\ + ssh stash status submodule svn svn-remote tag \ + tar trace2 transfer uploadarchive uploadpack \ + uploadpackfilter url user versionsort web \ + worktree ;; #<<# esac } -function completion//git::completesendemailoptionname { +function completion//git::completesendemailoptionname { #>># complete -P "$PREFIX" ${usesuffix:+-S "$suffix" -T} -- \ - aliasesfile aliasfiletype bcc cc cccmd chainreplyto confirm \ - envelopesender from multiedit signedoffbycc smtpdomain \ - smtppass smtpserver smtpserveroption smtpserverport smtpuser \ - suppresscc suppressfrom thread to validate -} - + aliasesFile aliasFileType annotate bcc cc ccCmd chainReplyTo \ + confirm envelopeSender forbidSendmailVariables from headerCmd \ + mailmap multiEdit signedOffByCc smtpBatchSize smtpDomain \ + smtpPass smtpReloginDelay smtpServer smtpServerOption \ + smtpServerPort smtpUser suppressCc suppressFrom thread to toCmd\ + transferEncoding validate xmailer + complete -P "$PREFIX" -S . -T -- mailmap +} #<<# # vim: set ft=sh ts=8 sts=8 sw=8 et: diff --git a/share/completion/git-describe b/share/completion/git-describe index cedd5619..0bde3a87 100644 --- a/share/completion/git-describe +++ b/share/completion/git-describe @@ -1,7 +1,7 @@ -# (C) 2014 magicant +# (C) 2014-2025 magicant # Completion script for the "git-describe" command. -# Supports Git 1.9.0. +# Supports Git 2.48.1. function completion/git-describe { WORDS=(git describe "${WORDS[2,-1]}") @@ -11,13 +11,16 @@ function completion/git-describe { function completion/git::describe:arg { OPTIONS=( #># + "--abbrev:; specify the number of hexadecimal digits" "--all; use any ref, not only an annotated tag" "--always; show uniquely abbreviated commit object as fallback" + "--broken:; describe HEAD even if the repository is broken" "--candidates:; specify the number of candidate tags" "--contains; use a tag that contains the described commit" "--debug; print debugging information" "--dirty::; describe HEAD with the specified suffix" "--exact-match; like --candidate=0" + "--exclude:; do not consider refs matching the given glob" "--first-parent; only follow first parents of merges" "--long; always print in the long format" "--match:; specify a pattern to restrict candidate tags" @@ -29,7 +32,9 @@ function completion/git::describe:arg { (-) command -f completion//completeoptions ;; -# (--dirty) +# (--broken|--dirty) +# ;; +# (--exclude) # ;; # (--match) # ;; diff --git a/share/completion/git-diff b/share/completion/git-diff index 15366209..3bad89dd 100644 --- a/share/completion/git-diff +++ b/share/completion/git-diff @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-diff" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-diff { WORDS=(git diff "${WORDS[2,-1]}") @@ -11,7 +11,12 @@ function completion/git-diff { function completion/git::diff:arg { OPTIONS=( #># + "0; no diff for unmerged files" + "1 --base; compare unmerged files with the merge base" + "2 --ours; compare unmerged files with our version" + "3 --theirs; compare unmerged files with their version" "--cached --staged; compare the index with a commit" + "--merge-base; compare with the merge base of two commits" ) #<# command -f completion/git::diff:getopt @@ -31,58 +36,92 @@ function completion/git::diff:arg { } function completion/git::diff:getopt { - typeset diff= case $gitcmd in - (diff|log|show|stash) diff=true;; + (diff|log|show) typeset u=u;; + (*) typeset u=;; + esac + case $gitcmd in + (format-patch) typeset no_format_patch=;; + (*) typeset no_format_patch=true;; esac OPTIONS=("$OPTIONS" #># "--abbrev::; abbreviate commit IDs" + "--anchored:; generate a diff with the specified anchor" "--binary; print diffs for binary files" "B:: --break-rewrites::; treat a way different file as a new file" "--cc; show diffs for resolved merge conflicts only" - "--check; check for whitespace errors" + "${no_format_patch:+--check}; check for whitespace errors" "--color::; show symbols in color" + "--color-moved:; show moved lines in the specified color" + "--color-moved-ws:; specify treatment of whitespace in moved lines" "--color-words::; like --word-diff=color --word-diff-regex=..." - "--diff-filter:; specify categories of changes to show" - "--dirstat::; print a dirstat with the specified style" + "--compact-summary; print an extended diffstat" + "--cumulative; print a diffstat with cumulative counts" + "--default-prefix; use the default prefix for filenames in diffs" + "--diff-algorithm:; specify a diff algorithm" + "${no_format_patch:+--diff-filter:}; specify categories of changes to show" + "X: --dirstat::; print a dirstat with the specified style" "--dirstat-by-file::; print the number of changed files" "--dst-prefix:; specify a prefix for destination filenames in diffs" - "--exit-code; return the exit status of 1 when there is any diffs" + "${no_format_patch:+--exit-code}; return the exit status of 1 when there is any diffs" "--ext-diff; use an external diff program" "C:: --find-copies::; detect copies of files with the specified threshold" "--find-copies-harder; find files copied from unmodified existing files" + "${no_format_patch:+--find-object}; specify an object to look for in diffs" "M:: --find-renames::; detect renames of files with the specified threshold" "--full-index; print full commit IDs in the patch format" - "G:; specify a regular expression to look for in diffs" + "W --function-context; show whole function as context" + "${no_format_patch:+G:}; specify a regular expression to look for in diffs" + "--histogram; generate a diff using the histogram diff algorithm" "w --ignore-all-space; ignore whitespaces in comparison" + "--ignore-blank-lines; ignore changes whose lines are all blank" + "--ignore-cr-at-eol; ignore carriage returns at end of lines" + "I: --ignore-matching-lines:; ignore changes that match the specified regex" "--ignore-space-at-eol; ignore changes in whitespace at end of lines" "b --ignore-space-change; ignore changes in amount of whitespaces only" "--ignore-submodules::; ignore changes to submodules" + "--indent-heuristic; shift diff hunk boundaries to align" "--inter-hunk-context:; specify the number of lines to show between hunks" "D --irreversible-delete; don't print diffs for deleted files" + "--ita-invisible-in-index; treat intent-to-add files as untracked" + "--ita-visible-in-index; treat intent-to-add files as was empty" "l:; specify a threshold at which rename/copy detection is given up" + "--line-prefix:; specify an additional prefix for lines in diffs" + "--minimal; minimize the diff at the cost of time" "--name-only; just print the names of differing files" "--name-status; just print the names and statuses of differing files" "--no-color; like --color=never" + "--no-color-moved; don't highlight moved lines" + "--no-color-moved-ws; treat whitespace intactly in moved lines" "--no-ext-diff; use the internal diff program" + "--no-indent-heuristic; disable shift of diff hunk boundaries" "--no-index; compare a file with another file outside the repository" "--no-prefix; don't prefix filenames in diffs" + "--no-relative; show diffs for all files, relative to the repository root" "--no-renames; disable rename detection" + "--no-rename-empty; don't use empty blobs as rename sources" "--no-textconv; don't use an external text filter to compare binary files" "--numstat; print a diffstat in the machine-friendly format" "O:; specify a file containing the order in which diffs are printed" - "${diff:+p} --patch; print a patch" - "--patch-with-raw; like --patch --raw" - "--patch-with-stat; like --patch --stat" + "--output:; specify a file to write the diff to" + "--output-indicator-context:; specify the indicator for context" + "--output-indicator-new:; specify the indicator for new files" + "--output-indicator-old:; specify the indicator for old files" + "${no_format_patch:+p} $u --patch; print a patch" + "${no_format_patch:+--patch-with-raw}; like --patch --raw" + "${no_format_patch:+--patch-with-stat}; like --patch --stat" "--patience; generate a diff using the patience diff algorithm" - "--pickaxe-all; show the whole changeset when -S/-G is specified" - "--pickaxe-regex; treat the specified string as a regular expression (with -S)" - "--quiet; don't print anything" - "R; print reverse diffs" - "--raw; print in the raw format" + "${no_format_patch:+--pickaxe-all}; show the whole changeset when -S/-G is specified" + "${no_format_patch:+--pickaxe-regex}; treat the specified string as a regular expression (with -S)" + "${no_format_patch:+--quiet}; don't print anything" + "${no_format_patch:+R}; print reverse diffs" + "${no_format_patch:+--raw}; print in the raw format" "--relative::; only show diffs in the specified directory" - "S:; specify a string to look for in diffs" + "--rename-empty; use empty blobs as rename sources" + "--rotate-to::; specify a file to start the diff from" + "${no_format_patch:+S:}; specify a string to look for in diffs" "--shortstat; print a diffstat summary" + "--skip-to:; discard files until the specified file is found" "--src-prefix:; specify a prefix for source filenames in diffs" "--stat::; print a diffstat with the specified column widths" "--stat-count:; specify the max number of files shown in the diffstat" @@ -93,9 +132,9 @@ function completion/git::diff:getopt { "a --text; assume all files are text" "--textconv; use an external text filter to compare binary files" "U:: --unified::; output in unified context format with the specified number of context lines" - "u; like -U3" "--word-diff::; print word-based diffs" "--word-diff-regex:; specify a regular expression that defines a word" + "${no_format_patch:+--ws-error-highlight:}; specify the whitespace error highlighting style" "z; print a null byte after each filename" ) #<# } @@ -107,8 +146,30 @@ function completion/git::diff:compopt (--color|--ignore-submodules) command -f completion/git::$ARGOPT:arg ;; + (--color-moved) #>># + complete -P "$PREFIX" -D "don't highlight moved lines" no + complete -P "$PREFIX" default + complete -P "$PREFIX" -D "detect moves line-wise" plain + complete -P "$PREFIX" -D "detect moved blocks of 20 characters or more" blocks + complete -P "$PREFIX" -D "like blocks, and use alternating colors for adjacent blocks" zebra + complete -P "$PREFIX" -D "like zebra, but dim uninteresting parts" dimmed-zebra + ;; #<<# + (--color-moved-ws) + typeset word="${TARGETWORD#"$PREFIX"}" + word=${word##*,} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" -D "treat whitespace intactly" no + complete -P "$PREFIX" -S , -T -D "ignore whitespace at end of lines" ignore-space-at-eol + complete -P "$PREFIX" -S , -T -D "ignore amount of whitespace" ignore-space-change + complete -P "$PREFIX" -S , -T -D "ignore all whitespace" ignore-all-space + complete -P "$PREFIX" -S , -T -D "group lines having the same change in whitespace" allow-indentation-change + ;; #<<# (--color-words|--word-diff-regex) ;; + (--diff-algorithm) #>># + complete -P "$PREFIX" \ + default histogram minimal myers patience + ;; #<<# (--diff-filter) #>># complete -P "$TARGETWORD" -D "added" A complete -P "$TARGETWORD" -D "pair broken" B @@ -119,9 +180,18 @@ function completion/git::diff:compopt complete -P "$TARGETWORD" -D "type modified" T complete -P "$TARGETWORD" -D "unmerged" U complete -P "$TARGETWORD" -D "unknown" X + complete -P "$TARGETWORD" -D "not added" a + complete -P "$TARGETWORD" -D "not pair broken" b + complete -P "$TARGETWORD" -D "not copied" c + complete -P "$TARGETWORD" -D "not deleted" d + complete -P "$TARGETWORD" -D "not modified" m + complete -P "$TARGETWORD" -D "not renamed" r + complete -P "$TARGETWORD" -D "not type modified" t + complete -P "$TARGETWORD" -D "not unmerged" u + complete -P "$TARGETWORD" -D "not unknown" x complete -P "$TARGETWORD" -D "all, if any of other flag matches" '*' ;; #<<# - (--dirstat|--dirstat-by-file) + (X|--dirstat|--dirstat-by-file) typeset word="${TARGETWORD#"$PREFIX"}" word=${word##*,} PREFIX=${TARGETWORD%"$word"} #>># @@ -137,6 +207,7 @@ function completion/git::diff:compopt complete -P "$PREFIX" -S / -T -d ;; (--submodule) #>># + complete -P "$PREFIX" -D "print diffs" diff complete -P "$PREFIX" -D "print logs for commits in submodules" log complete -P "$PREFIX" -D "just print pairs of commit IDs" short ;; #<<# @@ -146,6 +217,15 @@ function completion/git::diff:compopt complete -P "$PREFIX" -D "print in the machine-friendly format" porcelain complete -P "$PREFIX" -D "disable word-based diffs" none ;; #<<# + (--ws-error-highlight) + typeset word="${TARGETWORD#"$PREFIX"}" + word=${word##*,} + PREFIX=${TARGETWORD%"$word"} #>># + complete -P "$PREFIX" -S , -T context old new + complete -P "$PREFIX" -S , -T -D "clear" none + complete -P "$PREFIX" -S , -T -D "=none,new" default + complete -P "$PREFIX" -S , -T -D "=old,new,context" all + ;; #<<# (O|--dst-prefix|--src-prefix) complete -P "$PREFIX" -f ;; diff --git a/share/completion/git-diff-tree b/share/completion/git-diff-tree index dc64d877..b411b3ca 100644 --- a/share/completion/git-diff-tree +++ b/share/completion/git-diff-tree @@ -1,7 +1,7 @@ -# (C) 2012 magicant +# (C) 2012-2025 magicant # Completion script for the "git-diff-tree" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-diff-tree { WORDS=(git diff-tree "${WORDS[2,-1]}") @@ -37,7 +37,9 @@ function completion/git::diff-tree:getopt { OPTIONS=("$OPTIONS" #># "--always; show commit even if the diff is empty" "c; use the alternate format when printing a merge" + "--combined-all-paths; list all filenames in combined diff" "m; don't suppress showing diffs of merge commits" + "--merge-base; compare with the merge base of two commits" "--no-commit-id; don't print the commit ID" "r; compare directory trees recursively" "--root; compare against the null tree" diff --git a/share/completion/git-fetch b/share/completion/git-fetch index e941db69..760dc56f 100644 --- a/share/completion/git-fetch +++ b/share/completion/git-fetch @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-fetch" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-fetch { WORDS=(git fetch "${WORDS[2,-1]}") @@ -12,12 +12,11 @@ function completion/git::fetch:arg { OPTIONS=( #># "--dry-run; don't actually fetch anything" - "--multiple; allow specifying multiple remotes" - "p --prune; delete remote-tracking branches that no longer exist on the remote" "q --quiet; don't report progress" - "--submodule-prefix" # not for command line use + "--stdin; read refspecs from the standard input" + "--submodule-prefix:" # not for command line use "--recurse-submodules-default::" # not for command line use - "t --tags; fetch all tags from the remote" + "u --update-head-ok" # not for command line use "v --verbose" # TODO description ) #<# command -f completion/git::fetch:getopt @@ -27,7 +26,8 @@ function completion/git::fetch:arg { (-) command -f completion//completeoptions ;; - (--recurse-submodules|--upload-pack) + (--negotiation-tip|--recurse-submodules|--refmap| \ + --shallow-exclude|--upload-pack) command -f completion/git::$ARGOPT:arg ;; (--recurse-submodules-default) @@ -83,22 +83,51 @@ function completion/git::fetch:arg { } function completion/git::fetch:getopt { - typeset fetch= case ${gitcmd-} in - fetch) fetch=true;; + (pull) typeset no_pull=;; + (*) typeset no_pull=true;; esac OPTIONS=("$OPTIONS" #># + "4 --ipv4; use IPv4 addresses only" + "6 --ipv6; use IPv6 addresses only" "--all; fetch all remotes" "a --append; append to (not overwrite) existing FETCH_HEAD" + "--atomic; update all local refs atomically" + "${no_pull:+--auto-maintenance}; run maintenance tasks after fetching" "--depth:; specify the max number of history to fetch" + "--deepen:; deepen history of shallow clone by specified number of commits" "f --force; allow non-fast-forward update" + "j: --jobs:; specify the number of parallel fetches" "k --keep; keep downloaded pack" + "${no_pull:+--multiple}; allow specifying multiple remotes" + "--negotiate-only; just print ancestors of the negotiation tip" + "--negotiation-tip:; specify a commit to start negotiation at" + "--no-all; don't fetch all remotes" + "${no_pull:+--no-auto-maintenance}; don't run maintenance tasks after fetching" "--no-recurse-submodules; don't fetch submodules" - "${fetch+n} --no-tags; don't fetch tags automatically" + "--no-show-forced-updates" + "${no_pull:+n} --no-tags; don't fetch tags automatically" + "${no_pull:+--no-write-commit-graph}; don't write commit-graph" + "${no_pull:+--no-write-fetch-head}; don't update FETCH_HEAD" + "--porcelain; produce machine-readable output" + "--prefetch; record fetched objects for future use" "--progress; report progress" + "p --prune; delete remote-tracking branches that no longer exist on the remote" + "${no_pull:+P --prune-tags}; delete local tags that no longer exist on the remote" "--recurse-submodules::; specify whether to fetch submodules" - "u --update-head-ok" # not for command line use + "${no_pull:+--refetch}; fetch all objects anew" + "--refmap:; specify a local ref to receive fetched refs" + "o: --server-option:; specify a server option" + "--set-upstream; set upstream for the fetched ref" + "--shallow-exclude:; resize history of shallow clone by excluding commits reachable from specified refs" + "--shallow-since:; resize history of shallow clone to specified time" + "--show-forced-updates" + "t --tags; fetch all tags from the remote" + "--unshallow; convert shallow clone to complete clone" + "--update-shallow; accept refs that update shallow clone" "--upload-pack:; specify a path for git-upload-pack on the remote host" + "${no_pull:+--write-commit-graph}; write commit-graph" + "${no_pull:+--write-fetch-head}; update FETCH_HEAD" ) #<# } diff --git a/share/completion/git-format-patch b/share/completion/git-format-patch index 662c4ac5..f39e037a 100644 --- a/share/completion/git-format-patch +++ b/share/completion/git-format-patch @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-format-patch" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-format-patch { WORDS=(git format-patch "${WORDS[2,-1]}") @@ -12,25 +12,46 @@ function completion/git::format-patch:arg { OPTIONS=( #># "--add-header:; specify an additional header string" + "--always; produce patches even for empty commits" "--attach::; make patch contents an mail attachment" + "--base:; insert base commit info" "--cc:; specify an additional receiver" + "--cover-from-description:; specify which part of cover letter is auto-filled" "--cover-letter; create a file containing overall diffstat" + "--creation-factor:; specify the creation factor for the range-diff" + "--description-file:; specify a file containing the cover letter" + "--encode-email-headers; encode non-ASCII email headers" + "--filename-max-length:; specify the maximum length of the filenames" + "--force-in-body-from; always output an in-body 'From:' line" + "--from::; specify the email sender" "--ignore-if-in-upstream" "--inline::; like --attach, but use \"Content-Disposition: inline\"" "--in-reply-to:" + "--interdiff:; specify a revision to compare with and produce an interdiff" "k --keep-subject; don't add/remove \"[PATCH]\"" "--no-attach; cancel the --attach option" + "--no-base; don't insert base commit info" "--no-binary; don't include diffs for binary files" - "p --no-stat; create plain patches without diffstats" + "--no-cover-letter; don't create a cover letter" + "--no-encode-email-headers; keep non-ASCII email headers as-is" + "--no-force-in-body-from; cancel the --force-in-body-from option" + "--no-notes; don't append notes for each commit" "N --no-numbered; name output in \"[PATCH]\" format" "--no-signature; don't append a signature to results" + "p --no-stat; create plain patches without diffstats" + "--notes::; append notes for each commit" "--no-thread; don't thread mails" "n --numbered; name output in \"[PATCH n/m]\" format" "--numbered-files; use simple integers for output filenames" "o: --output-directory:; specify the directory to place the results in" - "--quiet; don't print created patch filenames" + "--progress; report progress" + "q --quiet; don't print created patch filenames" + "--range-diff:; specify a revision to compare with and produce a range-diff" + "v: --reroll-count:; mark patches with a specified version" + "--rfc::; prepend an additional subject prefix" "--root; treat the operand as a revision range" "--signature:; specify a signature appended to each message" + "--signature-file:; specify a file containing a signature" "s --signoff; include a signed-off-by line" "--start-number:; specify a number to start numbering patches from" "--stdout; output results to the standard output rather than files" @@ -38,6 +59,7 @@ function completion/git::format-patch:arg { "--suffix:; specify a suffix appended to result filenames" "--thread::; specify mail threading behavior" "--to:; specify an additional receiver" + "--zero-commit; replace commit hashes with zeros" ) #<# if command -vf completion/git::diff:getopt >/dev/null 2>&1 || . -AL completion/git-diff; then @@ -53,13 +75,36 @@ function completion/git::format-patch:arg { ;; (--attach|--inline) ;; + (--base) + complete -P "$PREFIX" auto + command -f completion/git::completeref + ;; + (--cover-from-description) #>># + complete -P "$PREFIX" -D "auto-fill message body" message default + complete -P "$PREFIX" -D "auto-fill message subject and body" subject + complete -P "$PREFIX" -D "based on description length" auto + complete -P "$PREFIX" none + ;; #<<# (--in-reply-to) ;; + (--interdiff|--range-diff) + command -f completion/git::completeref + ;; + (--notes) + command -f completion/git::completeref \ + abbrprefixes=refs/notes/ dontcompletefull=true \ + --glob=refs/notes/\* + ;; (o|--output-directory) complete -P "$PREFIX" -S / -T -d ;; + (--rfc) + ;; (--signature) ;; + (--signature-file) + complete -P "$PREFIX" -f + ;; (--start-number) ;; (--subject-prefix) diff --git a/share/completion/git-grep b/share/completion/git-grep index 748497ad..d29acf0c 100644 --- a/share/completion/git-grep +++ b/share/completion/git-grep @@ -1,7 +1,7 @@ -# (C) 2013-2018 magicant +# (C) 2013-2025 magicant # Completion script for the "git-grep" command. -# Supports Git 2.19.1. +# Supports Git 2.48.1. function completion/git-grep { WORDS=(git grep "${WORDS[2,-1]}") @@ -36,11 +36,13 @@ function completion/git::grep:arg { "i --ignore-case; case-insensitive matching" "L --files-without-match; print only the names of files containing no selected lines" "l --files-with-matches --name-only; print filenames only" + "m: --max-count:; limit the number of matches per file" "--max-depth:; specify directory depth to limit search" "n --line-number; print line numbers" "--no-color; like --color=never" "--no-exclude-standard; search ignored files" "--no-index; search files outside a working tree" + "--no-recursive; only search the operand directory" "--not; negate a pattern" "--no-textconv; ignore textconv settings" "O:: --open-files-in-pager::; open matching files in a pager" @@ -49,6 +51,7 @@ function completion/git::grep:arg { "p --show-function; print the name of the function containing the match" "P --perl-regexp; use Perl's regular expression" "q --quiet; don't print anything to the standard output" + "r --recursive; search subdirectories recursively" "--recurse-submodules; search submodules as well" "--textconv; honor textconv settings" "--threads:; specify the number of worker threads" diff --git a/share/completion/git-init b/share/completion/git-init index 1a89e98e..11635dd2 100644 --- a/share/completion/git-init +++ b/share/completion/git-init @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-init" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-init { WORDS=(git init "${WORDS[2,-1]}") @@ -12,7 +12,10 @@ function completion/git::init:arg { OPTIONS=( #># "--bare; create a bare repository" + "b: --initial-branch:; specify the initial branch name" + "--object-format:; specify a hash algorithm for objects" "q --quiet; print error and warning messages only" + "--ref-format:; specify a ref storage format" "--separate-git-dir:; specify the repository directory" "--shared::; share the repository with other users" "--template:; specify a directory that contains templates" @@ -35,6 +38,12 @@ function completion/git::init:arg { function completion/git::init:compopt case $ARGOPT in + (--object-format) #>># + complete -P "$PREFIX" sha1 sha256 + ;; #<<# + (--ref-format) + command -f completion/git::--ref-format:arg + ;; (--shared) #>># complete -P "$PREFIX" -D "set permissions according to the current umask" umask false complete -P "$PREFIX" -D "make the repository group-writable" group true diff --git a/share/completion/git-log b/share/completion/git-log index 262f1a1a..45289e8a 100644 --- a/share/completion/git-log +++ b/share/completion/git-log @@ -1,7 +1,7 @@ -# (C) 2011-2016 magicant +# (C) 2011-2025 magicant # Completion script for the "git-log" command. -# Supports Git 2.11.0. +# Supports Git 2.48.1. function completion/git-log { WORDS=(git log "${WORDS[2,-1]}") @@ -31,14 +31,19 @@ function completion/git::log:arg { function completion/git::log:getopt { OPTIONS=("$OPTIONS" #># "--bisect; show commits between good and bad only" + "--clear-decorations; decorate with the default set of refs" "--decorate::; show ref names of commits" + "--decorate-refs::; only decorate with refs that match the given pattern" + "--decorate-refs-exclude::; only decorate with refs that don't match the given pattern" "--follow; show history beyond filename renaming" "--full-diff; show diffs for all files affected in each commit" "L:; specify a range in a file to trace history" "--log-size; print its size before printing log messages" + "--mailmap --use-mailmap; canonicalize authors, committers and emails" "--no-decorate; like --decorate=no" + "--no-mailmap --no-use-mailmap; cancel the --mailmap option" "--source; show from which ref each commit was reached" - "--use-mailmap; canonicalize authors, committers and emails" + "t; show tree objects in the diff" ) #<# if command -vf completion/git::rev-list:getopt >/dev/null 2>&1 || . -AL completion/git-rev-list; then @@ -58,6 +63,9 @@ function completion/git::log:compopt complete -P "$PREFIX" -D "show ref names without prefixes" short complete -P "$PREFIX" -D "don't show ref names" no ;; #<<# + (--decorate-refs*) + command -f completion/git::completeref + ;; (L) case $TARGETWORD in (?*:*) typeset w="${TARGETWORD#?*:}" diff --git a/share/completion/git-ls-remote b/share/completion/git-ls-remote index 8cd981ad..475cfa89 100644 --- a/share/completion/git-ls-remote +++ b/share/completion/git-ls-remote @@ -1,7 +1,7 @@ -# (C) 2013 magicant +# (C) 2013-2025 magicant # Completion script for the "git-ls-remote" command. -# Supports Git 1.8.1.4. +# Supports Git 2.48.1. function completion/git-ls-remote { WORDS=(git ls-remote "${WORDS[2,-1]}") @@ -11,11 +11,16 @@ function completion/git-ls-remote { function completion/git::ls-remote:arg { OPTIONS=( #># + "b h --branches --heads; print branches only" "--exit-code; return a non-zero exit status if no refs were printed" "--get-url; just print remote URL" - "--heads; print branches only" - "--tags; print tags only" - "u: --upload-pack:; specify a path for git-upload-pack on the remote host" + "q --quiet; don't print remote URL" + "--refs; only show real refs" + "o: --server-option:; specify a server option" + "--sort:; specify the sort order" + "--symref; also show intermediate symbolic refs" + "t --tags; print tags only" + "--upload-pack:; specify a path for git-upload-pack on the remote host" ) #<# command -f completion//parseoptions -n @@ -23,6 +28,9 @@ function completion/git::ls-remote:arg { (-) command -f completion//completeoptions ;; + (--sort) + command -f completion/git::--sort:arg + ;; (u|--upload-pack) command -f completion/git::--upload-pack:arg ;; diff --git a/share/completion/git-merge b/share/completion/git-merge index 938bcd72..ecea5cd7 100644 --- a/share/completion/git-merge +++ b/share/completion/git-merge @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-merge" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-merge { WORDS=(git merge "${WORDS[2,-1]}") @@ -12,8 +12,14 @@ function completion/git::merge:arg { OPTIONS=( #># "--abort; reset to the state before starting merge" + "--continue; resume the ongoing merge" + "F: --file:; specify a file containing the message" + "--into-name:; specify the branch name to merge into" "m:; specify the message" + "--no-overwrite-ignore; abort if ignored files would be overwritten" "--no-rerere-autoupdate; disable the rerere mechanism" + "--overwrite-ignore; overwrite ignored files" + "--quit; end the merge and keep the current state" "--rerere-autoupdate; enable the rerere mechanism" ) #<# command -f completion/git::merge:getopt @@ -35,29 +41,51 @@ function completion/git::merge:arg { function completion/git::merge:getopt { OPTIONS=("$OPTIONS" #># + "--allow-unrelated-histories; allow merging branches without a common ancestor" + "--autostash; stash local changes before merging" + "--cleanup:; specify the way the message is cleaned up" "--commit; commit the merge result automatically" "--continue; continue the current merge" + "e --edit; edit the commit message" "--ff; fast-forward if possible" "--ff-only; allow fast-forward only" + "S:: --gpg-sign::; sign commits using GPG" "--log::; specify the number of commits in the merged branch of which the messages are reused" + "--no-autostash; cancel the --autostash option" "--no-commit; don't commit the merge result automatically" + "--no-edit; accept the default commit message without editing" "--no-ff; don't fast-forward even if possible" + "--no-gpg-sign; don't sign commits using GPG" "--no-log; don't reuse messages from the commits on the merged branch" "--no-progress; don't print progress info" + "--no-signoff; don't add a \"signed-off-by\" line to the message" "--no-squash; cancel the --squash option" "n --no-stat --no-summary; don't print a diffstat" + "--no-verify; bypass the pre-merge and commit-msg hooks" + "--no-verify-signatures; don't verify the signatures of the commits to be merged" "--progress; print progress info" "q --quiet; don't print anything" + "--signoff; add a \"signed-off-by\" line to the message" "--squash; like --no-commit, but don't set MERGE_HEAD" "--stat --summary; print a diffstat" "s: --strategy:; specify the merge strategy" "X: --strategy-option:; specify a strategy-specific option" "v --verbose; output additional information" + "--verify-signatures; verify the signatures of the commits to be merged" ) #<# } function completion/git::merge:compopt case $ARGOPT in + (--cleanup) + command -f completion/git::--cleanup:arg + ;; + (F|--file) + complete -P "$PREFIX" -f + ;; + (S|--gpg-sign) + command -f completion/git::--gpg-sign:arg + ;; (m|--log) ;; (s|--strategy) #>># diff --git a/share/completion/git-name-rev b/share/completion/git-name-rev index f9158bb1..dbf95ae9 100644 --- a/share/completion/git-name-rev +++ b/share/completion/git-name-rev @@ -1,7 +1,7 @@ -# (C) 2012 magicant +# (C) 2012-2025 magicant # Completion script for the "git" command. -# Supports Git 1.8.0.2. +# Supports Git 2.48.1. function completion/git-name-rev { WORDS=(git name-rev "${WORDS[2,-1]}") @@ -13,10 +13,12 @@ function completion/git::name-rev:arg { OPTIONS=( #># "--all; print all commits reachable from any refs" "--always; show uniquely abbreviated commit object as fallback" + "--exclude:; do not consider refs matching the given glob" "--name-only; don't print SHA-1 before each name" + "--no-exclude; cancel all previous --exclude options" "--no-undefined; exit with non-zero status for an undefined reference" "--refs:; specify refs that should be used by a pattern" - "--stdin; filter the standard input, appending a name to each SHA-1" + "--annotate-stdin --stdin; filter the standard input, appending a name to each SHA-1" "--tags; use tag names only" ) #<# @@ -25,10 +27,7 @@ function completion/git::name-rev:arg { (-) command -f completion//completeoptions ;; - (--refs) - command -f completion/git::completeref - ;; - ('') + (*) command -f completion/git::completeref ;; esac diff --git a/share/completion/git-notes b/share/completion/git-notes index 01e9d263..27f695c1 100644 --- a/share/completion/git-notes +++ b/share/completion/git-notes @@ -1,7 +1,7 @@ -# (C) 2016 magicant +# (C) 2016-2025 magicant # Completion script for the "git-notes" command. -# Supports Git 2.6.2. +# Supports Git 2.48.1. function completion/git-notes { WORDS=(git notes "${WORDS[2,-1]}") @@ -43,10 +43,15 @@ function completion/git::notes:add:arg { OPTIONS=( #># "C: --reuse-message:; specify a blob used as the note message" "c: --reedit-message:; like -C, but reedit the message" + "e --edit; edit the note message" "F: --file:; specify a file containing the note message" "f --force; overwrite existing note" "m: --message:; specify a note message" "--allow-empty; allow an empty note" + "--no-separator; don't insert a separator" + "--no-stripspace; leave leading and trailing spaces and blank lines" + "--separator::; specify a inter-paragraph separator" + "--stripspace; remove leading and trailing spaces and blank lines" ) #<# command -f completion//parseoptions @@ -91,6 +96,8 @@ function completion/git::notes:edit:arg { OPTIONS=( #># "--allow-empty; allow an empty note" + "--no-stripspace; leave leading and trailing spaces and blank lines" + "--stripspace; remove leading and trailing spaces and blank lines" ) #<# command -f completion//parseoptions diff --git a/share/completion/git-pull b/share/completion/git-pull index 786d288d..3e249f3e 100644 --- a/share/completion/git-pull +++ b/share/completion/git-pull @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-pull" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-pull { WORDS=(git pull "${WORDS[2,-1]}") @@ -11,9 +11,9 @@ function completion/git-pull { function completion/git::pull:arg { OPTIONS=( #># - "--no-rebase; cancel the --rebase option" + "--no-rebase; don't rebase but merge" "q --quiet; don't report progress" - "--rebase; rebase the current branch instead of merging" + "r:: --rebase::; rebase the current branch instead of merging" "v --verbose" # TODO description ) #<# if command -vf completion/git::fetch:getopt >/dev/null 2>&1 || @@ -30,11 +30,18 @@ function completion/git::pull:arg { (-) command -f completion//completeoptions ;; - (--recurse-submodules|--upload-pack) + (--negotiation-tip|--recurse-submodules|--refmap| \ + --shallow-exclude|--upload-pack) command -f completion/git::$ARGOPT:arg ;; # (--depth) # ;; + (r|--rebase) #>># + complete -P "$PREFIX" -D "don't rebase but merge" false + complete -P "$PREFIX" -D "rebase" true + complete -P "$PREFIX" -D "rebase recreating merge commits" merges + complete -P "$PREFIX" -D "rebase interactively" interactive + ;; #<<# ('') command -f completion//getoperands if [ ${WORDS[#]} -eq 0 ]; then diff --git a/share/completion/git-push b/share/completion/git-push index 038fe406..54a92d56 100644 --- a/share/completion/git-push +++ b/share/completion/git-push @@ -1,7 +1,7 @@ -# (C) 2011-2014 magicant +# (C) 2011-2025 magicant # Completion script for the "git-push" command. -# Supports Git 2.0.1. +# Supports Git 2.48.1. function completion/git-push { WORDS=(git push "${WORDS[2,-1]}") @@ -11,24 +11,34 @@ function completion/git-push { function completion/git::push:arg { OPTIONS=( #># - "--all; push all local branches" - "--delete; delete remote refs specified as operands" + "4 --ipv4; use IPv4 addresses only" + "6 --ipv6; use IPv6 addresses only" + "--atomic; update all remote refs atomically" + "--branches --all; push all local branches" + "d --delete; delete remote refs specified as operands" "n --dry-run; don't actually push anything" "--follow-tags; push reachable annotated tags as well" "f --force; allow non-fast-forward update" + "--force-if-includes; force only if the current remote has been locally integrated" "--force-with-lease::; like --force, but prevent unexpected history loss" "--mirror; push all local refs" + "--no-atomic; don't require atomic updates" + "--no-force-if-includes; cancel the --force-if-includes option" "--no-force-with-lease; cancel the --force-with-lease option" + "--no-recurse-submodules; don't push submodules" + "--no-signed; don't GPG-sign the push request" "--no-thin; cancel the --thin option" "--no-verify; disable the pre-push hook" "--porcelain; print in the machine-friendly format" "--progress; report progress" "--prune; delete remote branches that have no local counterparts" + "o: --push-option:; send the specified option to the remote" "q --quiet; don't report progress" "--repo:; specify the default repository to push to" "--receive-pack: --exec:; specify a path for git-receive-pack on the remote host" "--recurse-submodules:; ensure submodule commits are available on the remote" "u --set-upstream; make pushed branches remote-tracking" + "--signed::; GPG-sign the push request" "--tags; push all local tags" "--thin; send a thin pack to reduce traffic" "v --verbose; output additional information" @@ -52,6 +62,9 @@ function completion/git::push:arg { (--recurse-submodules) #>># complete -P "$PREFIX" -D "check if submodules have been pushed" check complete -P "$PREFIX" -D "push submodules as necessary" on-demand + complete -P "$PREFIX" -D "push submodules but not the superproject" + only + complete -P "$PREFIX" -D "don't push submodules" no ;; #<<# (--repo|'') command -f completion//getoperands @@ -76,6 +89,11 @@ function completion/git::push:arg { esac fi ;; + (--signed) #>># + complete -P "$PREFIX" -D "always sign" true + complete -P "$PREFIX" -D "never sign" false + complete -P "$PREFIX" -D "sign if supported by the server" if-asked + ;; #<<# esac } diff --git a/share/completion/git-rebase b/share/completion/git-rebase index 0ddeea76..11f43e95 100644 --- a/share/completion/git-rebase +++ b/share/completion/git-rebase @@ -1,7 +1,7 @@ -# (C) 2011-2019 magicant +# (C) 2011-2025 magicant # Completion script for the "git-rebase" command. -# Supports Git 2.24.0. +# Supports Git 2.48.1. function completion/git-rebase { WORDS=(git rebase "${WORDS[2,-1]}") @@ -32,14 +32,16 @@ function completion/git::rebase:getopt { OPTIONS=("$OPTIONS" #># "--abort; abort the current rebasing and reset to the original" "--allow-empty-message" + "--apply; use git-am internally" "--autosquash; find commits to be squashed (with -i)" "--autostash; stash before and restore after rebasing" "--committer-date-is-author-date; use author date for committer date" "--continue; continue the current rebasing" "--edit-todo; re-edit the to-do list of the current rebasing" + "--empty:; specify how to handle commits that become empty" "f --force-rebase --no-ff; create new commits without fast-forwarding" "--fork-point; use reflog to find a better common ancestor" - "--ignore-date; use committer date for author date" + "--ignore-date --reset-author-date; reset author date to current time" "i --interactive; interactively reedit commits that are rebased" "--keep-base; apply commits starting from the same merge base" "--keep-empty; don't omit commits that make no change" @@ -47,14 +49,19 @@ function completion/git::rebase:getopt { "--no-autosquash; cancel the --autosquash option" "--no-autostash; cancel the --autostash option" "--no-fork-point; ignore reflog when finding a better common ancestor" + "--no-gpg-sign; don't sign commits with GPG" + "--no-keep-empty; omit commits that make no change" + "--no-reapply-cherry-picks; drop cherry-picks from the upstream" "--no-reschedule-failed-exec" "--no-rerere-autoupdate; disable the rerere mechanism" "n --no-stat; don't print a diffstat" + "--no-update-refs; don't update other branches" "--no-verify; don't run the pre-rebase hook" "--onto; specify a branch to rebase onto" # Deprecated "p --preserve-merges; don't ignore merge commits" "q --quiet; don't print anything" "--quit; end suspended rebasing and keep the current state" + "--reapply-cherry-picks; keep cherry-picks from the upstream" "r --rebase-merges::; recreate merge commits" "--rerere-autoupdate; enable the rerere mechanism" "--reschedule-failed-exec" @@ -67,6 +74,7 @@ function completion/git::rebase:getopt { "s: --strategy:; specify the merge strategy" "x: --exec:; insert an \"exec\" line with the specified command after each commit (with -i)" "X: --strategy-option:; specify a strategy-specific option" + "--update-refs; update other branches to point at the rebased commits" "v --verbose; output additional information" "--verify; run the pre-rebase hook" ) #<# @@ -78,11 +86,14 @@ function completion/git::rebase:getopt { function completion/git::rebase:compopt case $ARGOPT in + (--empty) + command -f completion/git::--empty:arg + ;; (--rebase-merges) complete -P "$PREFIX" no-rebase-cousins rebase-cousins ;; (S|--gpg-sign) - #TODO + command -f completion/git::--gpg-sign:arg ;; (*) if command -vf completion/git::apply:compopt >/dev/null 2>&1 || diff --git a/share/completion/git-reflog b/share/completion/git-reflog index f2246afd..0eff911c 100644 --- a/share/completion/git-reflog +++ b/share/completion/git-reflog @@ -1,7 +1,7 @@ -# (C) 2016 magicant +# (C) 2016-2025 magicant # Completion script for the "git-reflog" command. -# Supports Git 2.6.2. +# Supports Git 2.48.1. function completion/git-reflog { WORDS=(git reflog "${WORDS[2,-1]}") @@ -10,7 +10,7 @@ function completion/git-reflog { function completion/git::reflog:arg if [ ${WORDS[#]} -le 1 ]; then - complete -P "$PREFIX" delete exists expire show + complete -P "$PREFIX" delete exists expire list show else WORDS=("${WORDS[2,-1]}") if command -vf "completion/git::reflog:${WORDS[1]}:arg" >/dev/null 2>&1; then @@ -31,6 +31,9 @@ function completion/git::reflog:exists:arg { # Not supported, since the expire subcommand is not mainly for interactive use. # function completion/git::reflog:expire:arg +# The list subcommand takes no arguments. +# function completion/git::reflog:list:arg + function completion/git::reflog:show:arg { WORDS=(git log -g --abbrev-commit --pretty=oneline "${WORDS[2,-1]}") command -f completion//reexecute diff --git a/share/completion/git-remote b/share/completion/git-remote index 3f7632b3..cca39215 100644 --- a/share/completion/git-remote +++ b/share/completion/git-remote @@ -1,7 +1,7 @@ -# (C) 2011-2019 magicant +# (C) 2011-2025 magicant # Completion script for the "git-remote" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-remote { WORDS=(git remote "${WORDS[2,-1]}") @@ -29,9 +29,10 @@ function completion/git::remote:arg { (*) #>># complete -P "$PREFIX" -D "add a remote" add complete -P "$PREFIX" -D "rename a remote" rename - complete -P "$PREFIX" -D "remove a remote" rm + complete -P "$PREFIX" -D "remove a remote" remove complete -P "$PREFIX" -D "set the default branch of a remote" set-head complete -P "$PREFIX" -D "set remote-tracking branches" set-branches + complete -P "$PREFIX" -D "show the URL of a remote" get-url complete -P "$PREFIX" -D "set the URL of a remote" set-url complete -P "$PREFIX" -D "show a remote" show complete -P "$PREFIX" -D "delete remote-tracking branches that no longer exist on a remote" prune @@ -82,6 +83,10 @@ function completion/git::remote:rename:arg { } function completion/git::remote:rm:arg { + command -f completion/git::remote:remove:arg +} + +function completion/git::remote:remove:arg { command -f completion/git::completeremote } @@ -123,6 +128,25 @@ function completion/git::remote:set-branches:arg { command -f completion/git::remote:set-head:arg "$@" } +function completion/git::remote:get-url:arg { + + OPTIONS=( #># + "--all; list all URLs for the remote" + "--push; get push URLs instead of fetch URLs" + ) #<# + + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + command -f completion/git::completeremote + ;; + esac + +} + function completion/git::remote:set-url:arg { OPTIONS=( #># diff --git a/share/completion/git-request-pull b/share/completion/git-request-pull index fab285fc..fb86fef7 100644 --- a/share/completion/git-request-pull +++ b/share/completion/git-request-pull @@ -1,7 +1,7 @@ -# (C) 2012 magicant +# (C) 2012-2025 magicant # Completion script for the "git" command. -# Supports Git 1.8.0.2. +# Supports Git 2.48.1. function completion/git-request-pull { WORDS=(git request-pull "${WORDS[2,-1]}") @@ -11,7 +11,7 @@ function completion/git-request-pull { function completion/git::request-pull:arg { OPTIONS=( #># - "p; print a patch" + "p; include a patch" ) #<# command -f completion//parseoptions -es diff --git a/share/completion/git-reset b/share/completion/git-reset index eda558b9..c811cde9 100644 --- a/share/completion/git-reset +++ b/share/completion/git-reset @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-reset" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-reset { WORDS=(git reset "${WORDS[2,-1]}") @@ -15,8 +15,17 @@ function completion/git::reset:arg { "--keep; like --hard, but keep working tree changes" "--merge; reset out of a conflicted merge" "--mixed; reset the index but keep the working tree" + "N --intent-to-add; keep removed files as intent-to-add" + "--no-intent-to-add" + "--no-patch" + "--no-recurse-submodules; don't reset submodules" + "--no-refresh; don't refresh the index" "p --patch; interactively choose patch hunks to reset" + "--pathspec-file-nul; use nul as separator for pathspecs" + "--pathspec-from-file:; read pathspecs from a file" "q --quiet; print error and warning messages only" + "--recurse-submodules; also reset submodules" + "--refresh; refresh the index" "--soft; keep the index and working tree intact" ) #<# diff --git a/share/completion/git-rev-list b/share/completion/git-rev-list index 99b9380d..0d67ae77 100644 --- a/share/completion/git-rev-list +++ b/share/completion/git-rev-list @@ -1,7 +1,7 @@ -# (C) 2011-2016 magicant +# (C) 2011-2025 magicant # Completion script for the "git-rev-list" command. -# Supports Git 2.9.2. +# Supports Git 2.48.1. function completion/git-rev-list { WORDS=(git rev-list "${WORDS[2,-1]}") @@ -14,12 +14,25 @@ function completion/git::rev-list:arg { "--bisect; print a midpoint commit in current bisect" "--bisect-all" "--bisect-vars" + "--commit-header; show commit IDs for each commit" "--count; print the number of selected commits only" + "--disk-usage::; show storage size used by selected commits" + "--filter:; show commits that match the specified criteria only" + "--filter-print-omitted; mark filtered objects in the output" + "--filter-provided-objects; apply --filter to provided objects" + # for internal use only: "--exclude-promisor-objects" "--header; print commits in the raw format" + "--in-commit-order; print trees and blobs in commit order" + "--indexed-objects; print object IDs referenced by the index" + "--missing:; specify how to handle missing objects" + "--no-commit-header; suppress lines showing commit IDs" + "--no-filter; cancel the --filter option" + "--no-object-names; don't print object names" + "--object-names; print object names (with --objects)" "--objects; print object IDs referenced by selected commits" "--objects-edge; like --objects, but print excluded commits too" "--objects-edge-aggressive; like --objects-edge, but more slow and accurate" - "--indexed-objects; print object IDs referenced by the index" + "--progress:; show progress" "--timestamp; print the raw timestamp values" "--unpacked; print object IDs that are not in packs" ) #<# @@ -45,9 +58,9 @@ function completion/git::rev-list:getopt { command -f completion/git::getprettyopts command -f completion/git::getrefselectopts OPTIONS=("$OPTIONS" #># - "--ancestry-path; show commits on the ancestor-descendant path only" + "--ancestry-path::; show commits on the ancestor-descendant path only" "--all-match; show commits that match all the other filter options only" - "--after: --since:; show commits after the specified date only" + "--alternate-refs; show refs of alternate repositories" "--author:; show commits by the specified author only" "--basic-regexp; use basic regular expression" "--before: --until:; show commits before the specified date only" @@ -60,6 +73,8 @@ function completion/git::rev-list:getopt { "--date:; specify a date format" "--dense; show commits that have a diff" "--do-walk; traverse commit ancestors" + "--exclude-first-parent-only; don't exclude commits merged from topic branches" + "--exclude-hidden:; apply hideRefs to exclude refs" "E --extended-regexp; use extended regular expression" "--first-parent; follow first parent of each commit only" "F --fixed-strings; perform simple string matching rather than regular expression" @@ -83,7 +98,7 @@ function completion/git::rev-list:getopt { "--no-min-parents; like --min-parents=0" "--no-walk::; don't traverse commit ancestors" "--parents; print parents' commit IDs as well" - "--perl-regexp; use Perl's regular expression" + "P --perl-regexp; use Perl's regular expression" "--quiet; print nothing" "i --regexp-ignore-case; case-insensitive regular expression matching" "--reflog; show all reflogs" @@ -92,8 +107,12 @@ function completion/git::rev-list:getopt { "--reverse; print in reverse order" "--right-only; show commits on the right-hand-side branch only" "--show-linear-break::; show a separator between branches" + "--show-pulls" # TODO description "--simplify-by-decoration; show branch/tag heads only" "--simplify-merges; don't show merges that re-merge an ancestor" + "--since: --after:; stop at the first commit after the specified date" + "--since-as-filter:; show commits after the specified date only" + "--single-worktree; show commits in the current worktree only" "--sparse; show all walked commits" "--stdin; read arguments from the standard input" "--use-bitmap-index" @@ -105,10 +124,10 @@ function completion/git::rev-list:getopt { function completion/git::rev-list:compopt case $ARGOPT in - (n|--max-*|--min-*) + (n|--max-*|--min-*|--progress) # complete nothing ;; - (--author|--date) + (--author|--date|--exclude-hidden|--filter) command -f "completion/git::$ARGOPT:arg" ;; (--after|--before|--since|--until) @@ -121,6 +140,15 @@ function completion/git::rev-list:compopt done 2>/dev/null \ <(git log --all --format=format:%cn | uniq) ;; + (--disk-usage) #>># + complete -P "$PREFIX" -D "human-readable" human + ;; #<<# + (--missing) #>># + complete -P "$PREFIX" -D "stop on missing objects" error + complete -P "$PREFIX" -D "ignore missing objects" allow-any + complete -P "$PREFIX" -D "ignore expected missing objects" allow-promisor + complete -P "$PREFIX" -D "mark missing objects" print + ;; #<<# (--no-walk) complete -P "$PREFIX" sorted unsorted ;; diff --git a/share/completion/git-rev-parse b/share/completion/git-rev-parse index 65ac4b08..d701ee81 100644 --- a/share/completion/git-rev-parse +++ b/share/completion/git-rev-parse @@ -1,7 +1,7 @@ -# (C) 2016 magicant +# (C) 2016-2025 magicant # Completion script for the "git-rev-parse" command. -# Supports Git 2.9.2. +# Supports Git 2.48.1. function completion/git-rev-parse { WORDS=(git rev-parse "${WORDS[2,-1]}") @@ -12,10 +12,13 @@ function completion/git::rev-parse:arg { OPTIONS=( #># "--abbrev-ref::; print in short object names" + "--absolute-git-dir; print the absolute path of the repository" "--after: --since:; convert the specified date to --max-age timestamp" "--before: --until:; convert the specified date to --mim-age timestamp" "--default; specify a default argument" "--disambiguate:; show all SHA-1 values that start with the specified prefix" + "--end-of-options" + "--exclude-hidden:; apply hideRefs to exclude refs" "--flags; print options only" "--git-common-dir; print the main repository path" "--git-dir; print the repository path" @@ -23,20 +26,26 @@ function completion/git::rev-parse:arg { "--is-bare-repository; test if the repository is bare" "--is-inside-git-dir; test if the current directory is inside a repository" "--is-inside-work-tree; test if the current directory is inside a working tree" + "--is-shallow-repository; test if the repository is shallow" "--keep-dashdash" "--local-env-vars; print repository-local environment variables" "--no-flags; print operands only" "--no-revs; ignore arguments meant for rev-list" "--not; negate printed object names" + "--output-object-format:; convert object IDs to the specified format" "--parseopt; enable option parsing mode" + "--path-format:" "--prefix; specify a directory to operate in" "q --quiet; don't print any error message (with --verify)" + "--show-ref-format; print the ref format used in the current repository" "--resolve-git-dir; test if the operand is a repository path" "--revs-only; ignore arguments not meant for rev-list" "--shared-index-path; print the shared index file path" "--short::; abbreviate printed SHA-1 values" "--show-cdup; print a relative path to the top-level directory" + "--show-object-format:; print the object format used in the current repository" "--show-prefix; print a relative path from the top-level directory" + "--show-superproject-working-tree; print the path to the superproject working tree" "--show-toplevel; print the absolute path of the top-level directory" "--sq; print with shell-friendly quotation" "--sq-quote; enable shell quoting mode" @@ -59,6 +68,18 @@ function completion/git::rev-parse:arg { complete -P "$PREFIX" -D "allow ambiguous names" loose complete -P "$PREFIX" -D "ensure unambiguous names" strict ;; #<<# + (--exclude-hidden) + command -f completion/git::--exclude-hidden:arg + ;; + (--output-object-format) #>># + complete -P "$PREFIX" sha1 sha256 storage + ;; #<<# + (--path-format) #>># + complete -P "$PREFIX" absolute relative + ;; #<<# + (--show-object-format) #>># + complete -P "$PREFIX" storage input output + ;; #<<# ('') command -f completion/git::completerefpath range=true ;; diff --git a/share/completion/git-revert b/share/completion/git-revert index 02d3cfd1..f15dc056 100644 --- a/share/completion/git-revert +++ b/share/completion/git-revert @@ -1,7 +1,7 @@ -# (C) 2011-2016 magicant +# (C) 2011-2025 magicant # Completion script for the "git-revert" command. -# Supports Git 2.9.3. +# Supports Git 2.48.1. function completion/git-revert { WORDS=(git revert "${WORDS[2,-1]}") @@ -12,12 +12,17 @@ function completion/git::revert:arg { OPTIONS=( #># "--abort; end suspended revert and restore the original state" + "--cleanup:; specify the way the message is cleaned up" "--continue; resume suspended revert" "e --edit; (re)edit the message" "m: --mainline:; specify the mainline parent by number" "n --no-commit; don't commit the reversion result automatically" "--no-edit; don't reedit the message" + "--no-gpg-sign; don't sign commits using GPG" + "--no-rerere-autoupdate; don't update the index with rerere resolution" "--quit; end suspended quit and keep the current state" + "--reference; use the reference format in the message" + "--rerere-autoupdate; update the index with rerere resolution" "S:: --gpg-sign::; sign commits with GPG" "s --signoff; add a \"signed-off-by\" line to the message" "--strategy:; specify the merge strategy" diff --git a/share/completion/git-rm b/share/completion/git-rm index 05c577ff..1f18a70f 100644 --- a/share/completion/git-rm +++ b/share/completion/git-rm @@ -1,7 +1,7 @@ -# (C) 2015 magicant +# (C) 2015-2025 magicant # Completion script for the "git-rm" command. -# Supports Git 2.2.2. +# Supports Git 2.48.1. function completion/git-rm { WORDS=(git rm "${WORDS[2,-1]}") @@ -15,8 +15,11 @@ function completion/git::rm:arg { "n --dry-run; don't actually remove files" "f --force; forcibly remove files with uncommitted changes" "--ignore-unmatch; pretend success even if no files matched" + "--pathspec-file-nul; use nul as separator for pathspecs" + "--pathspec-from-file:; read pathspecs from file" "q --quiet; don't report which files are being removed" "-r; remove directories recursively" + "--sparse; update index outside of sparse-checkout cone" ) #<# command -f completion//parseoptions -n @@ -24,6 +27,9 @@ function completion/git::rm:arg { (-) command -f completion//completeoptions ;; + (--pathspec-from-file) + complete -P "$PREFIX" -f + ;; ('') command -f completion/git::completepath -r ;; diff --git a/share/completion/git-show b/share/completion/git-show index 6f42888f..25f90c5a 100644 --- a/share/completion/git-show +++ b/share/completion/git-show @@ -1,7 +1,7 @@ # (C) 2011 magicant # Completion script for the "git-show" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-show { WORDS=(git show "${WORDS[2,-1]}") diff --git a/share/completion/git-show-branch b/share/completion/git-show-branch index df87b025..586fd4a3 100644 --- a/share/completion/git-show-branch +++ b/share/completion/git-show-branch @@ -1,7 +1,7 @@ # (C) 2011 magicant # Completion script for the "git-show-branch" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-show-branch { WORDS=(git show-branch "${WORDS[2,-1]}") diff --git a/share/completion/git-stash b/share/completion/git-stash index 93a54e4d..206c07ae 100644 --- a/share/completion/git-stash +++ b/share/completion/git-stash @@ -1,7 +1,7 @@ -# (C) 2011-2018 magicant +# (C) 2011-2025 magicant # Completion script for the "git-stash" command. -# Supports Git 2.18.0. +# Supports Git 2.48.1. function completion/git-stash { WORDS=(git stash "${WORDS[2,-1]}") @@ -105,11 +105,15 @@ function completion/git::stash:push:arg { OPTIONS=( #># "a --all; stash all files including ignored/untracked files" + "u --include-untracked; stash untracked files as well as tracked files" "k --keep-index; keep the index intact" + "m: --message:; specify the stash message" + "--no-keep-index; stash and reset the index" "p --patch; interactively choose patch hunks to stash" + "--pathspec-file-nul; use nul as separator for pathspecs" + "--pathspec-from-file:; read pathspecs from file" "q --quiet; print error messages only" - "--no-keep-index; stash and reset the index" - "u --include-untracked; stash untracked files as well as tracked files" + "S --staged; stash only staged changes" ) #<# case ${WORDS[1]} in (push|-*) OPTIONS=("$OPTIONS" #># @@ -125,6 +129,9 @@ function completion/git::stash:push:arg { fi command -f completion//completeoptions ;; + (--pathspec-from-file) + complete -P "$PREFIX" -f + ;; ('') case ${WORDS[1]} in (-*) typeset i @@ -150,7 +157,11 @@ function completion/git::stash:save:arg { function completion/git::stash:show:arg { - OPTIONS=() + OPTIONS=( #># + "u --include-untracked; show untracked files" + "--no-include-untracked; don't show untracked files" + "--only-untracked; show only untracked files" + ) #<# if command -vf completion/git::diff:getopt >/dev/null 2>&1 || . -AL completion/git-diff; then command -f completion/git::diff:getopt diff --git a/share/completion/git-status b/share/completion/git-status index 167770f8..8eebd9e9 100644 --- a/share/completion/git-status +++ b/share/completion/git-status @@ -1,7 +1,7 @@ -# (C) 2011-2014 magicant +# (C) 2011-2025 magicant # Completion script for the "git-status" command. -# Supports Git 1.8.5.3. +# Supports Git 2.48.1. function completion/git-status { WORDS=(git status "${WORDS[2,-1]}") @@ -11,15 +11,22 @@ function completion/git-status { function completion/git::status:arg { OPTIONS=( #># + "--ahead-behind; show the number of commits ahead/behind the remote branch" "b --branch; print the current branch" "--column::; columnize output" - "--ignored; print ignored files as well" + "--find-renames::; detect renames" + "--ignored::; print ignored files as well" "--ignore-submodules::; ignore changes to submodules" "--long --no-short; print in the long format" + "--no-ahead-behind; don't show the number of commits ahead/behind the remote branch" "--no-column; print files line by line" - "--porcelain; print in the machine-friendly format" + "--no-renames; don't show renamed files" + "--porcelain::; print in the machine-friendly format" + "--renames; show renamed files" "s --short; print in the short format" + "--show-stash; show the stash entry count" "u:: --untracked-files::; print untracked files" + "v --verbose; show the diff of uncommitted changes" "z; print a null byte after each filename" ) #<# @@ -31,9 +38,17 @@ function completion/git::status:arg { (--column) command -f completion/git::--column:arg ;; + (--ignored) #>># + complete -P "$PREFIX" -D "show all ignored files recursively" traditional + complete -P "$PREFIX" -D "don't show ignored files" no + complete -P "$PREFIX" -D "show files matching an ignore pattern" matching + ;; #<<# (--ignore-submodules) command -f completion/git::--ignore-submodules:arg ;; + (--porcelain) + complete -P "$PREFIX" v1 v2 + ;; (u|--untracked-files) command -f completion/git::--untracked-files:arg ;; diff --git a/share/completion/git-submodule b/share/completion/git-submodule index 9d3df544..5c803b4d 100644 --- a/share/completion/git-submodule +++ b/share/completion/git-submodule @@ -1,7 +1,7 @@ -# (C) 2013-2016 magicant +# (C) 2013-2025 magicant # Completion script for the "git-submodule" command. -# Supports Git 1.8.1.4. +# Supports Git 2.48.1. function completion/git-submodule { WORDS=(git submodule "${WORDS[2,-1]}") @@ -14,7 +14,7 @@ function completion/git::submodule:arg { "q --quiet; print error messages only" ) #<# - while [ x"${WORDS[2]}" = x"-q" ] || [ x"${WORDS[2]}" = x"--quiet" ]; do + while case "${WORDS[2]}" in (--cached|-q|--quiet) true ;; (*) false ;; esac; do WORDS=("${WORDS[1]}" "${WORDS[3,-1]}") done @@ -24,14 +24,20 @@ function completion/git::submodule:arg { complete -P "$PREFIX" -- -q ;; (-*) + OPTIONS=("$OPTIONS" #># + "--cached; print status of the superproject index" + ) #<# command -f completion//parseoptions command -f completion//completeoptions ;; (*) #>># + complete -P "$PREFIX" -D "move the git directories from submodules to the superproject" absorbgitdirs complete -P "$PREFIX" -D "add a submodule" add complete -P "$PREFIX" -D "unregister submodules" deinit complete -P "$PREFIX" -D "execute a shell command in each submodule" foreach complete -P "$PREFIX" -D "configure submodules according to .gitmodules" init + complete -P "$PREFIX" -D "set the default tracking branch for a submodule" set-branch + complete -P "$PREFIX" -D "set the URL of a submodule" set-url complete -P "$PREFIX" -D "show status of submodules" status complete -P "$PREFIX" -D "print summary of changes in submodules" summary complete -P "$PREFIX" -D "reset submodule remote URL" sync @@ -47,14 +53,23 @@ function completion/git::submodule:arg { } +function completion/git::submodule:absorbgitdirs:arg { + + complete -P "$PREFIX" -S / -T -d + +} + function completion/git::submodule:add:arg { OPTIONS=("$OPTIONS" #># "b: --branch:; specify a branch of the submodule to clone" "--depth:; specify the max number of history to clone" + "--dissociate; stop borrowing objects after cloning" "f --force; add an ignored path" "--name:; specify the name of the submodule" + "--progress; force progress reporting" "--reference:; specify a reference repository to share objects (possibly dangerous operation)" + "--ref-format:; specify a ref storage format" ) #<# command -f completion//parseoptions @@ -69,6 +84,9 @@ function completion/git::submodule:add:arg { (--reference) complete -P "$PREFIX" -S / -T -d ;; + (--ref-format) + command -f completion/git::--ref-format:arg + ;; ('') command -f completion//getoperands if command -vf completion/git::clone:opr >/dev/null 2>&1 || @@ -83,6 +101,7 @@ function completion/git::submodule:add:arg { function completion/git::submodule:deinit:arg { OPTIONS=("$OPTIONS" #># + "--all; unregister all submodules" "f --force; overwrite local changes or ignore unmerged files" ) #<# @@ -123,10 +142,35 @@ function completion/git::submodule:init:arg { } +function completion/git::submodule:set-branch:arg { + + OPTIONS=("$OPTIONS" #># + "b: --branch:; specify a branch of the submodule to track" + "d --default; reset to the remote's default branch" + ) #<# + + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + complete -P "$PREFIX" -S / -T -d + ;; + esac + +} + +function completion/git::submodule:set-url:arg { + + complete -P "$PREFIX" -S / -T -d + +} + function completion/git::submodule:status:arg { OPTIONS=("$OPTIONS" #># - "--cached; print status of the supermodule index" + "--cached; print status of the superproject index" "--recursive; operate on all submodules recursively" ) #<# @@ -145,8 +189,8 @@ function completion/git::submodule:status:arg { function completion/git::submodule:summary:arg { OPTIONS=("$OPTIONS" #># - "--cached; compare the supermodule HEAD and index" - "--files; compare the supermodule index with the submodule HEAD" + "--cached; compare the superproject HEAD and index" + "--files; compare the superproject index with the submodule HEAD" "n: --summary-limit:; specify the max number of commits to show" ) #<# @@ -189,15 +233,25 @@ function completion/git::submodule:sync:arg { function completion/git::submodule:update:arg { OPTIONS=("$OPTIONS" #># + "--checkout; check out in submodules" "--depth:; specify the max number of history to clone" + "--dissociate; stop borrowing objects after cloning" + "--filter:; partial-clone by applying a filter" "f --force; overwrite local changes or ignore unmerged files" "--init; do \"git submodule init\" before updating" + "--jobs:; specify the max number of submodules to clone in parallel" "--merge; merge in submodules" "N --no-fetch; don't fetch from submodule remotes" + "--no-recommend-shallow; always fully clone submodules" + "--no-single-branch; clone all branches" + "--progress; force progress reporting" "--rebase; rebase in submodules" + "--recommend-shallow; shallow-clone if recommended in .gitmodules" "--recursive; operate on all submodules recursively" "--reference:; specify a reference repository to share objects (possibly dangerous operation)" + "--ref-format:; specify a ref storage format" "--remote; update submodules to their remote's latest commit" + "--single-branch; clone only the target branch" ) #<# command -f completion//parseoptions @@ -205,10 +259,10 @@ function completion/git::submodule:update:arg { (-) command -f completion//completeoptions ;; - (--reference) - complete -P "$PREFIX" -S / -T -d + (--filter|--ref-format) + command -f "completion/git::$ARGOPT:arg" ;; - ('') + (--reference|'') complete -P "$PREFIX" -S / -T -d ;; esac diff --git a/share/completion/git-svn b/share/completion/git-svn index 9074fb0c..b6ee8dc8 100644 --- a/share/completion/git-svn +++ b/share/completion/git-svn @@ -1,7 +1,7 @@ -# (C) 2011-2015 magicant +# (C) 2011-2025 magicant # Completion script for the "git-svn" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-svn { WORDS=(git svn "${WORDS[2,-1]}") @@ -29,6 +29,7 @@ function completion/git::svn:arg complete -P "$PREFIX" -D "print revision log" log complete -P "$PREFIX" -D "recreate empty directories" mkdirs complete -P "$PREFIX" -D "reduce local repository size" gc + complete -P "$PREFIX" -D "set a property of a file" propset complete -P "$PREFIX" -D "show a file with commit info" blame complete -P "$PREFIX" -D "undo fetch" reset else #<<# @@ -67,6 +68,7 @@ function completion/git::svn:branch:arg { "d: --destination:; specify a branch/tag path to operate on" "n --dry-run; don't actually make a branch/tag" "m: --message:; specify the commit message" + "--parents; create missing parent directories" "t --tag; create a tag rather than a branch" "--username:; specify a user name for authentication" ) #<# @@ -99,6 +101,7 @@ function completion/git::svn:clone:arg { "--placeholder-filename:; specify the name of dummy files in empty directories" ) #<# command -f completion/git::svn:getcommonopt + #command -f completion/git::svn:getregexfilteropt # included in fetch:getopt command -f completion/git::svn:fetch:getopt command -f completion/git::svn:init:getopt @@ -156,8 +159,10 @@ function completion/git::svn:commit-diff:getopt { OPTIONS=("$OPTIONS" #># "--add-author-from; add an author name to each log message" "e --edit; reedit the message" + "F: --file:; specify a file containing the message" "--find-copies-harder" #TODO "l:" #TODO + "m: --message:; specify the commit message" "--rmdir; remove empty directories from the Subversion tree" ) #<# command -f completion/git::svn:getauthoropt @@ -191,9 +196,11 @@ function completion/git::svn:dcommit:arg { OPTIONS=( #># "--commit-url:; specify a repository URL to commit to" "n --dry-run; don't actually commit anything" + "--interactive; interactively confirm each commit" "m --merge; use merging strategies to rebase" "--mergeinfo:; specify mergeinfo to add" "--no-rebase; don't rebase after committing" + "--rebase-merges; recreate merge commits while rebasing" "s: --strategy:; specify the merge strategy" ) #<# command -f completion/git::svn:getcommonopt @@ -248,18 +255,22 @@ function completion/git::svn:fetch:arg { function completion/git::svn:fetch:getopt { OPTIONS=("$OPTIONS" #># - "--ignore-paths:; specify a regular expression whose matching pathnames are ignored when fetching" "--localtime; store Git commit dates in the local timezone" + "--log-window-size:; fetch the specified number of commits at once" #"--repack::" obsolete option #"--repack-flags:" obsolete option "--use-log-author; find author names out of log messages" ) #<# command -f completion/git::svn:getauthoropt + command -f completion/git::svn:getregexfilteropt } function completion/git::svn:find-rev:arg { - OPTIONS=() + OPTIONS=( #># + "A --after; find the earliest equal commit" + "B --before; find the last equal commit" + ) #<# command -f completion/git::svn:getcommonopt command -f completion//parseoptions @@ -309,6 +320,7 @@ function completion/git::svn:init:arg { "--template:; specify a directory that contains templates" ) #<# command -f completion/git::svn:getcommonopt + command -f completion/git::svn:getregexfilteropt command -f completion/git::svn:init:getopt command -f completion//parseoptions @@ -332,7 +344,6 @@ function completion/git::svn:init:arg { function completion/git::svn:init:getopt { OPTIONS=("$OPTIONS" #># "b: --branches:; specify the branches subdirectory name" - "--ignore-paths:; specify a regular expression whose matching pathnames are ignored when fetching" "--no-metadata; set the noMetadata option" "--no-minimize-url; don't normalize URL to the repository root" "--prefix:; specify the prefix for trunk/branches/tags" @@ -351,13 +362,17 @@ function completion/git::svn:log:arg { OPTIONS=( #># "--incremental; print output in a format suitable for concatenation" - "--limit:; specify the number of revisions to show at most" + "--limit:; specify the max number of revisions to show" "--oneline; use only one line for each revision" "r: --revision:; specify a revision (range) to show" "--show-commit; show git commit IDs as well" "v --verbose; print additional info" ) #<# command -f completion/git::svn:getcommonopt + if command -vf completion/git::log:getopt >/dev/null 2>&1 || + . -AL completion/git-log; then + command -f completion/git::log:getopt + fi command -f completion//parseoptions -n case $ARGOPT in @@ -372,7 +387,10 @@ function completion/git::svn:log:arg { command -f completion/git::completepath -a ;; (*) - command -f completion/git::svn:compopt + command -f completion/git::svn:compopt || + if command -vf completion/git::log:compopt >/dev/null 2>&1; then + command -f completion/git::log:compopt + fi ;; esac @@ -437,6 +455,33 @@ function completion/git::svn:proplist:arg { } +function completion/git::svn:propset:arg { + + OPTIONS=() + + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + command -f completion//getoperands + case ${WORDS[#]} in + (0) + # TODO complete property name + ;; + (1) + # property value + ;; + (2) + command -f completion/git::completepath -r + ;; + esac + ;; + esac + +} + function completion/git::svn:rebase:arg { OPTIONS=( #># @@ -549,7 +594,11 @@ function completion/git::svn:tag:arg { function completion/git::svn:getcommonopt { OPTIONS=("$OPTIONS" #># + "--follow-parent; recreate history with branching and merged commits" + "i: --id:; specify a ref name to fetch from" + "--no-follow-parent; create a linear history" "q --quiet; print less messages" + "R: --svn-remote: specify the Subversion remote" ) #<# } @@ -560,9 +609,17 @@ function completion/git::svn:getauthoropt { ) #<# } +function completion/git::svn:getregexfilteropt { + OPTIONS=("$OPTIONS" #># + "--ignore-paths:; ignore paths matching the specified regular expression" + "--ignore-refs:; ignore refs matching the specified regular expression" + "--include-paths:; only fetch paths that match the specified regular expression" + ) #<# +} + function completion/git::svn:compopt case $ARGOPT in - (A|--authors-file|--ignore-paths|--placeholder-filename) + ([AF]|--authors-file|--file|--ignore-paths|--include-paths|--placeholder-filename) complete -P "$PREFIX" -f ;; (--authors-prog) diff --git a/share/completion/git-switch b/share/completion/git-switch index 2f442661..7c3e6bee 100644 --- a/share/completion/git-switch +++ b/share/completion/git-switch @@ -1,7 +1,8 @@ # (C) 2023 Victorien Elvinger +# (C) 2025 magicant # Completion script for the "git-switch" command. -# Supports Git 2.23.0. +# Supports Git 2.48.1. function completion/git-switch { WORDS=(git switch "${WORDS[2,-1]}") @@ -27,7 +28,7 @@ function completion/git::switch:arg { "--progress; report progress status on standard error" "q --quiet; print error and warning messages only" "--recurse-submodules; update the content of all active submodules" - "t --track; create a tracking branch" + "t:: --track::; create a tracking branch" ) #<# command -f completion//parseoptions @@ -41,7 +42,11 @@ function completion/git::switch:arg { (--conflict) #>># complete -P "$PREFIX" -D "ours and theirs" merge complete -P "$PREFIX" -D "ours, theirs, and original" diff3 + complete -P "$PREFIX" zdiff3 ;; #<<# + (t|--track) + command -f completion/git::--track:arg + ;; ('') # Parse options that modify completion behavior, # and find first non-option argument. diff --git a/share/completion/git-tag b/share/completion/git-tag index 0faace5b..330ad4db 100644 --- a/share/completion/git-tag +++ b/share/completion/git-tag @@ -1,7 +1,7 @@ -# (C) 2011 magicant +# (C) 2011-2025 magicant # Completion script for the "git-tag" command. -# Supports Git 1.7.7. +# Supports Git 2.48.1. function completion/git-tag { WORDS=(git tag "${WORDS[2,-1]}") @@ -11,17 +11,33 @@ function completion/git-tag { function completion/git::tag:arg { OPTIONS=( #># - "a; make an unsigned annotated tag" + "a --annotate; make an unsigned annotated tag" + "--cleanup:; specify the way the message is cleaned up" + "--color::; show in color" + "--column::; columnize output" "--contains:; list tags that are ancestors of the specified commit" - "d; delete tags" - "F:; specify a file containing the message" + "--create-reflog; enable reflog for the new tag" + "d --delete; delete tags" + "e --edit; edit the tag message" + "F: --file:; specify a file containing the message" "f --force; overwrite an existing tag" - "l; list tag names that match an operand" - "m:; specify the message" + "--format:; specify an output format" + "i --ignore-case; sort and filter tags case-insensitively" + "l --list; list tag names that match an operand" + "u: --local-user:; specify a key to make a GPG-signed tag with" + "m: --message:; specify the message" + "--merged:; list tags that are descendants of the specified commit" "n::; specify the number of lines of annotation to print" - "s; make a GPG-signed tag with the default email address's key" - "u:; specify a key to make a GPG-signed tag with" - "v; verify tags" + "--no-column; print tags line by line" + "--no-contains:; list tags that are not ancestors of the specified commit" + "--no-merged:; list tags that are not descendants of the specified commit" + "--no-sign; don't GPG-sign the tag" + "--omit-empty; don't print empty items" + "--points-at:; list tags that point at the specified commit" + "s --sign; make a GPG-signed tag with the default email address's key" + "--sort:; sort listed tags" + "--trailer:; specify token-value pair to append to the message" + "v --verify; verify the GPG signature of tags" ) #<# command -f completion//parseoptions -n @@ -29,6 +45,9 @@ function completion/git::tag:arg { (-) command -f completion//completeoptions ;; + (--cleanup|--color|--column|--format|--sort) + command -f completion/git::$ARGOPT:arg + ;; (--contains) command -f completion/git::completeref ;; @@ -40,6 +59,11 @@ function completion/git::tag:arg { i=$((i+1)) break ;; + (--contains|--delete|--list|--merged| \ + --no-contains|--no-merged|--points-at|--verify) + nomake=true + break + ;; (--*) i=$((i+1)) ;; diff --git a/share/completion/git-whatchanged b/share/completion/git-whatchanged index 25642c2a..980f1578 100644 --- a/share/completion/git-whatchanged +++ b/share/completion/git-whatchanged @@ -1,7 +1,7 @@ -# (C) 2013 magicant +# (C) 2013-2025 magicant # Completion script for the "git-whatchanged" command. -# Supports Git 1.8.1.4. +# Supports Git 2.48.1. function completion/git-whatchanged { WORDS=(git whatchanged "${WORDS[2,-1]}") @@ -10,31 +10,11 @@ function completion/git-whatchanged { function completion/git::whatchanged:arg { - OPTIONS=() - - if command -vf completion/git::diff-tree:getopt >/dev/null 2>&1 || - . -AL completion/git-diff-tree; then - command -f completion/git::diff-tree:getopt - fi - if command -vf completion/git::rev-list:getopt >/dev/null 2>&1 || - . -AL completion/git-rev-list; then - command -f completion/git::rev-list:getopt + if command -vf completion/git::log:arg >/dev/null 2>&1 || + . -AL completion/git-log; then + command -f completion/git::log:arg fi - command -f completion//parseoptions -n - case $ARGOPT in - (-) - command -f completion//completeoptions - ;; - ('') - command -f completion/git::completerefpath range=true - ;; - (*) - command -f completion/git::diff-tree:compopt || - command -f completion/git::rev-list:compopt - ;; - esac - } diff --git a/share/completion/git-worktree b/share/completion/git-worktree index 1392b61e..bd47eed6 100644 --- a/share/completion/git-worktree +++ b/share/completion/git-worktree @@ -1,7 +1,7 @@ -# (C) 2016 magicant +# (C) 2016-2025 magicant # Completion script for the "git-worktree" command. -# Supports Git 2.7.0. +# Supports Git 2.48.1. function completion/git-worktree { WORDS=(git worktree "${WORDS[2,-1]}") @@ -9,9 +9,16 @@ function completion/git-worktree { } function completion/git::worktree:arg - if [ ${WORDS[#]} -le 1 ]; then - complete -P "$PREFIX" add prune list - else + if [ ${WORDS[#]} -le 1 ]; then #>># + complete -P "$PREFIX" -D "create a new worktree" add + complete -P "$PREFIX" -D "clean up info for deleted worktrees" prune + complete -P "$PREFIX" -D "show worktree status" list + complete -P "$PREFIX" -D "prevent a worktree from being pruned" lock + complete -P "$PREFIX" -D "move a worktree" move + complete -P "$PREFIX" -D "remove a worktree" remove + complete -P "$PREFIX" -D "recover worktree metadata" repair + complete -P "$PREFIX" -D "unlock a worktree" unlock + else #<<# WORDS=("${WORDS[2,-1]}") if command -vf "completion/git::worktree:${WORDS[1]}:arg" >/dev/null 2>&1; then command -f "completion/git::worktree:${WORDS[1]}:arg" @@ -23,8 +30,20 @@ function completion/git::worktree:add:arg { OPTIONS=( #># "B:; create or reset a new branch and check it out" "b:; create a new branch and check it out" + "--checkout; check out the branch in the new worktree" "--detach; leave HEAD in detached head state" - "f --force; allow multiple working trees for single branch" + "f --force; allow multiple working trees for a single branch" + "--guess-remote; guess which remote to use for a new branch" + "--lock; keep the working tree locked" + "--no-checkout; don't check out the branch in the new worktree" + "--no-guess-remote; don't create a new branch from a remote" + "--no-relative-paths; save worktrees with absolute paths" + "--no-track; create a non-tracking branch" + "--orphan; create a new branch with no parent" + "q --quiet; print error messages only" + "--reason:; specify a reason for locking the working tree" + "--relative-paths; save worktree paths relative to the main tree" + "t --track; create a tracking branch" ) #<# command -f completion//parseoptions @@ -35,6 +54,9 @@ function completion/git::worktree:add:arg { ([Bb]) command -f completion/git::completeref --branches ;; +# (--track) +# command -f completion/git::--track:arg +# ;; ('') command -f completion//getoperands case ${WORDS[#]} in @@ -50,11 +72,65 @@ function completion/git::worktree:add:arg { } +function completion/git::worktree:list:arg { + + OPTIONS=( #># + "--expire:; annotate missing worktrees older than the specified time" + "--porcelain; print in the machine-friendly format" + "v --verbose; print lock reasons as well" + "z; use NUL as separator" + ) #<# + + command -f completion//parseoptions -n + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + ;; + esac + +} + +function completion/git::worktree:lock:arg { + + OPTIONS=( #># + "--reason:; specify a reason for locking the working tree" + ) #<# + + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + complete -P "$PREFIX" -S / -T -d + ;; + esac + +} + +function completion/git::worktree:move:arg { + + OPTIONS=() + + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + command -P "$PREFIX" -S / -T -d + ;; + esac + +} + function completion/git::worktree:prune:arg { OPTIONS=( #># "--expire:; specify age of working trees to remove" - "n --dry-run; don't remove any working trees" + "n --dry-run; don't remove anything, just report" "v --verbose; report removed working trees" ) #<# @@ -70,18 +146,54 @@ function completion/git::worktree:prune:arg { } -function completion/git::worktree:list:arg { +function completion/git::worktree:remove:arg { OPTIONS=( #># - "--porcelain; print in the machine-friendly format" + "--force; remove even if the worktree is dirty" ) #<# - command -f completion//parseoptions -n + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + complete -P "$PREFIX" -S / -T -d + ;; + esac + +} + +function completion/git::worktree:repair:arg { + + OPTIONS=( #># + "--no-relative-paths; save worktrees with absolute paths" + "--relative-paths; save worktree paths relative to the main tree" + ) #<# + + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + complete -P "$PREFIX" -S / -T -d + ;; + esac + +} + +function completion/git::worktree:unlock:arg { + + OPTIONS=() + + command -f completion//parseoptions case $ARGOPT in (-) command -f completion//completeoptions ;; ('') + complete -P "$PREFIX" -S / -T -d ;; esac From 1937506b1d910aec3c9dc523b45f692e8cff75cf Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Fri, 21 Feb 2025 21:41:02 +0900 Subject: [PATCH 2/2] Add completion for git-mv --- NEWS | 1 + NEWS.ja | 1 + share/completion/git-mv | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 share/completion/git-mv diff --git a/NEWS b/NEWS index a5da2e86..69640542 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ to be ignored. - [line-editing] Updated the completion scripts to support Git 2.48.1. + - [line-editing] Added the completion script for `git-mv`. - Fixed a possible crash when the `read` built-in reads input in an interactive shell. - Added a workaround for an apparent bug in glibc's fsetpos function diff --git a/NEWS.ja b/NEWS.ja index 23dd69b6..72988ed6 100644 --- a/NEWS.ja +++ b/NEWS.ja @@ -9,6 +9,7 @@ - `trap` 組込みはシェルが起動された時点で最初から無視されていた シグナルも表示するようになった - [行編集] 補完スクリプトを Git 2.48.1 相当に更新 + - [行編集] git-mv の補完を追加 - 対話シェルで `read` 組込みが入力を読み込む際にクラッシュすることが あったのを修正 - glibc の fsetpos 関数が正しく動作しないために履歴ファイルが更新 diff --git a/share/completion/git-mv b/share/completion/git-mv new file mode 100644 index 00000000..00122f78 --- /dev/null +++ b/share/completion/git-mv @@ -0,0 +1,41 @@ +# (C) 2025 magicant + +# Completion script for the "git-mv" command. +# Supports Git 2.48.1. + +function completion/git-mv { + WORDS=(git mv "${WORDS[2,-1]}") + command -f completion//reexecute +} + +function completion/git::mv:arg { + + OPTIONS=( #># + "-f --force; force move/rename even if target exists" + "-k; ignore errors when moving/renaming a file" + "-n --dry-run; don't actually move/rename files" + "-v --verbose; report what is being done" + ) #<# + + command -f completion//parseoptions + case $ARGOPT in + (-) + command -f completion//completeoptions + ;; + ('') + command -f completion//getoperands + case ${WORDS[#]} in + (0) + command -f completion/git::completepath -r + ;; + (*) + complete -P "$PREFIX" -f + ;; + esac + ;; + esac + +} + + +# vim: set ft=sh ts=8 sts=8 sw=8 et: