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
|
# (C) 2011-2025 magicant
# Completion script for the "git-log" command.
# Supports Git 2.48.1.
function completion/git-log {
WORDS=(git log "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::log:arg {
OPTIONS=()
command -f completion/git::log:getopt
command -f completion//parseoptions -n
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
('')
command -f completion/git::completerefpath range=true
;;
(*)
command -f completion/git::log:compopt
;;
esac
}
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"
"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
command -f completion/git::rev-list:getopt
fi
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
}
function completion/git::log:compopt
case $ARGOPT in
(--decorate) #>>#
complete -P "$PREFIX" -D "like short, only if outputting to a terminal" auto
complete -P "$PREFIX" -D "show full ref names" full
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#?*:}"
typeset PREFIX="${TARGETWORD%"$w"}"
command -f completion/git::completepath -r
esac
;;
(*)
command -f completion/git::rev-list:compopt ||
command -f completion/git::diff:compopt
;;
esac
# vim: set ft=sh ts=8 sts=8 sw=8 et:
|