@ -64,14 +64,19 @@ __git_ps1 ()
__gitcomp ()
__gitcomp ()
{
{
local all c s=$'\n' IFS=' '$'\t'$'\n'
local all c s=$'\n' IFS=' '$'\t'$'\n'
local cur="${COMP_WORDS[COMP_CWORD]}"
if [ -n "$2" ]; then
cur="$3"
fi
for c in $1; do
for c in $1; do
case "$c" in
case "$c$4" in
--*=*) all="$all$c$s" ;;
--*=*) all="$all$c$4$s" ;;
*) all="$all$c $s" ;;
*.) all="$all$c$4$s" ;;
*) all="$all$c$4 $s" ;;
esac
esac
done
done
IFS=$s
IFS=$s
COMPREPLY=($(compgen -W "$all" -- "${COMP_WORDS[COMP_CWORD]}"))
COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
return
return
}
}
@ -666,26 +671,40 @@ _git_config ()
local prv="${COMP_WORDS[COMP_CWORD-1]}"
local prv="${COMP_WORDS[COMP_CWORD-1]}"
case "$prv" in
case "$prv" in
branch.*.remote)
branch.*.remote)
COMPREPLY=($(compgen -W "$(__git_remotes)" -- "$cur"))
__gitcomp "$(__git_remotes)"
return
return
;;
;;
branch.*.merge)
branch.*.merge)
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
__gitcomp "$(__git_refs)"
return
return
;;
;;
remote.*.fetch)
remote.*.fetch)
local remote="${prv#remote.}"
local remote="${prv#remote.}"
remote="${remote%.fetch}"
remote="${remote%.fetch}"
COMPREPLY=($(compgen -W "$(__git_refs_remotes "$remote")" \
__gitcomp "$(__git_refs_remotes "$remote")"
-- "$cur"))
return
return
;;
;;
remote.*.push)
remote.*.push)
local remote="${prv#remote.}"
local remote="${prv#remote.}"
remote="${remote%.push}"
remote="${remote%.push}"
COMPREPLY=($(compgen -W "$(git --git-dir="$(__gitdir)" \
__gitcomp "$(git --git-dir="$(__gitdir)" \
for-each-ref --format='%(refname):%(refname)' \
for-each-ref --format='%(refname):%(refname)' \
refs/heads)" -- "$cur"))
refs/heads)"
return
;;
pull.twohead|pull.octopus)
__gitcomp "$(__git_merge_strategies)"
return
;;
color.branch|color.diff|color.status)
__gitcomp "always never auto"
return
;;
color.*.*)
__gitcomp "
black red green yellow blue magenta cyan white
bold dim ul blink reverse
"
return
return
;;
;;
*.*)
*.*)
@ -695,41 +714,39 @@ _git_config ()
esac
esac
case "$cur" in
case "$cur" in
--*)
--*)
COMPREPLY=($(compgen -W "
__gitcomp "
--global --list --replace-all
--global --list --replace-all
--get --get-all --get-regexp
--get --get-all --get-regexp
--unset --unset-all
--unset --unset-all
" -- "$cur"))
"
return
return
;;
;;
branch.*.*)
branch.*.*)
local pfx="${cur%.*}."
local pfx="${cur%.*}."
cur="${cur##*.}"
cur="${cur##*.}"
COMPREPLY=($(compgen -P "$pfx" -W "remote merge" -- "$cur"))
__gitcomp "remote merge" "$pfx" "$cur"
return
return
;;
;;
branch.*)
branch.*)
local pfx="${cur%.*}."
local pfx="${cur%.*}."
cur="${cur#*.}"
cur="${cur#*.}"
COMPREPLY=($(compgen -P "$pfx" -S . \
__gitcomp "$(__git_heads)" "$pfx" "$cur" "."
-W "$(__git_heads)" -- "$cur"))
return
return
;;
;;
remote.*.*)
remote.*.*)
local pfx="${cur%.*}."
local pfx="${cur%.*}."
cur="${cur##*.}"
cur="${cur##*.}"
COMPREPLY=($(compgen -P "$pfx" -W "url fetch push" -- "$cur"))
__gitcomp "url fetch push" "$pfx" "$cur"
return
return
;;
;;
remote.*)
remote.*)
local pfx="${cur%.*}."
local pfx="${cur%.*}."
cur="${cur#*.}"
cur="${cur#*.}"
COMPREPLY=($(compgen -P "$pfx" -S . \
__gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
-W "$(__git_remotes)" -- "$cur"))
return
return
;;
;;
esac
esac
COMPREPLY=($(compgen -W "
__gitcomp "
apply.whitespace
apply.whitespace
core.fileMode
core.fileMode
core.gitProxy
core.gitProxy
@ -741,40 +758,67 @@ _git_config ()
core.warnAmbiguousRefs
core.warnAmbiguousRefs
core.compression
core.compression
core.legacyHeaders
core.legacyHeaders
i18n.commitEncoding
core.packedGitWindowSize
i18n.logOutputEncoding
core.packedGitLimit
diff.color
color.branch
color.branch.current
color.branch.local
color.branch.remote
color.branch.plain
color.diff
color.diff
diff.renameLimit
color.diff.plain
diff.renames
color.diff.meta
pager.color
color.diff.frag
color.diff.old
color.diff.new
color.diff.commit
color.diff.whitespace
color.pager
color.pager
status.color
color.status
color.status
log.showroot
color.status.header
show.difftree
color.status.added
showbranch.default
color.status.changed
whatchanged.difftree
color.status.untracked
diff.renameLimit
diff.renames
fetch.unpackLimit
format.headers
gitcvs.enabled
gitcvs.logfile
gc.reflogexpire
gc.reflogexpireunreachable
gc.rerereresolved
gc.rerereunresolved
http.sslVerify
http.sslVerify
http.sslCert
http.sslCert
http.sslKey
http.sslKey
http.sslCAInfo
http.sslCAInfo
http.sslCAPath
http.sslCAPath
http.maxRequests
http.maxRequests
http.lowSpeedLimit http.lowSpeedTime
http.lowSpeedLimit
http.lowSpeedTime
http.noEPSV
http.noEPSV
i18n.commitEncoding
i18n.logOutputEncoding
log.showroot
merge.summary
merge.verbosity
pack.window
pack.window
pull.octopus
pull.twohead
repack.useDeltaBaseOffset
repack.useDeltaBaseOffset
pull.octopus pull.twohead
show.difftree
merge.summary
showbranch.default
tar.umask
transfer.unpackLimit
receive.unpackLimit
receive.unpackLimit
receive.denyNonFastForwards
receive.denyNonFastForwards
user.name user.email
user.name
tar.umask
user.email
gitcvs.enabled
user.signingkey
gitcvs.logfile
whatchanged.difftree
branch. remote.
branch. remote.
" -- "$cur"))
"
}
}
_git_reset ()
_git_reset ()