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
|
# (C) 2011-2025 magicant
# Completion script for the "git-push" command.
# Supports Git 2.48.1.
function completion/git-push {
WORDS=(git push "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::push:arg {
OPTIONS=( #>#
"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"
"--verify; enable the pre-push hook"
) #<#
command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
(--force-with-lease)
typeset word="${TARGETWORD#"$PREFIX"}"
word=${word#*:}
PREFIX=${TARGETWORD%"$word"}
command -f completion/git::completeref
;;
(--receive-pack|--exec)
command -f completion/git::--receive-pack: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
if [ ${WORDS[#]} -eq 0 ]; then
#TODO complete remote URI
command -f completion/git::completeremote
elif [ "${WORDS[-1]}" = tag ]; then
command -f completion/git::completeref --tags
else
typeset word="${TARGETWORD#"$PREFIX"}"
word=${word#+}
case $word in
(*:*) # complete remote refs
word=${word#*:}
PREFIX=${TARGETWORD%"$word"}
command -f completion/git::completeremoteref "${WORDS[1]}"
;;
(*) # complete local refs
PREFIX=${TARGETWORD%"$word"}
command -f completion/git::completeref
;;
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
}
# vim: set ft=sh ts=8 sts=8 sw=8 et:
|