1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
# (C) 2011-2025 magicant
# Completion script for the "git-rev-list" command.
# Supports Git 2.48.1.
function completion/git-rev-list {
WORDS=(git rev-list "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::rev-list:arg {
OPTIONS=( #>#
"--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"
"--progress:; show progress"
"--timestamp; print the raw timestamp values"
"--unpacked; print object IDs that are not in packs"
) #<#
command -f completion/git::rev-list:getopt
command -f completion//parseoptions -n
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
('')
command -f completion/git::completerefpath range=true
;;
(*)
command -f completion/git::rev-list:compopt
;;
esac
}
function completion/git::rev-list:getopt {
command -f completion/git::getorderopts
command -f completion/git::getprettyopts
command -f completion/git::getrefselectopts
OPTIONS=("$OPTIONS" #>#
"--ancestry-path::; show commits on the ancestor-descendant path only"
"--all-match; show commits that match all the other filter options 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"
"--boundary; show excluded boundary commits"
"--cherry; like --right-only --cherry-mark --no-merges"
"--cherry-mark; like --cherry-pick, but mark commits"
"--cherry-pick; omit commits duplicated by cherry-picking"
"--children; print children's commit IDs as well"
"--committer:; show commits by the specified committer only"
"--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"
"--full-history; follow all parents of merges even if the parents have no diff"
"--graph; print commit ancestry tree graph"
"--grep:; show commits whose log message matches the specified pattern only"
"--grep-reflog:; show commits whose reflog message matches the specified pattern only"
"--ignore-missing; ignore nonexistent refs"
"--invert-grep; show commits that don't match --grep=..."
"--left-only; show commits on the left-hand-side branch only"
"--left-right; show reachability of commits from branches"
# not meant for interactive use: "--max-age:"
"n: --max-count:; specify the max number of commits shown"
"--max-parents:; show commits with at most the specified number of parents only"
"--merge; show refs that touch conflicting files"
"--merges; like --min-parents=2 (show merge commits only)"
# not meant for interactive use: "--min-age:"
"--min-parents:; show commits with at least the specified number of parents only"
"--no-max-parents; like --max-parents=-1"
"--no-merges; like --max-parents=1 (don't show merge commits)"
"--no-min-parents; like --min-parents=0"
"--no-walk::; don't traverse commit ancestors"
"--parents; print parents' commit IDs as well"
"P --perl-regexp; use Perl's regular expression"
"--quiet; print nothing"
"i --regexp-ignore-case; case-insensitive regular expression matching"
"--reflog; show all reflogs"
"--relative-date; like --date=relative"
"--remove-empty; stop when a given path disappears from the tree"
"--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"
"g --walk-reflogs; show reflogs instead of ancestry chain"
) #<#
# "--not" is not included in this list because it is actually
# an operand rather than an option.
}
function completion/git::rev-list:compopt
case $ARGOPT in
(n|--max-*|--min-*|--progress)
# complete nothing
;;
(--author|--date|--exclude-hidden|--filter)
command -f "completion/git::$ARGOPT:arg"
;;
(--after|--before|--since|--until)
# TODO complete date
;;
(--committer)
typeset committer
while read -r committer; do
complete -P "$PREFIX" -- "$committer"
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
;;
(*)
command -f completion/git::completeprettyopts ||
command -f completion/git::completerefselectopts
;;
esac
# vim: set ft=sh ts=8 sts=8 sw=8 et:
|