elif [ -d "$g/rebase-merge" ]; then
r="|REBASE-m"
b="$(cat "$g/rebase-merge/head-name")"
- elif [ -f "$g/MERGE_HEAD" ]; then
- r="|MERGING"
- b="$(git symbolic-ref HEAD 2>/dev/null)"
else
+ if [ -f "$g/MERGE_HEAD" ]; then
+ r="|MERGING"
+ fi
if [ -f "$g/BISECT_LOG" ]; then
r="|BISECTING"
fi
- if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
- if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
- if [ -r "$g/HEAD" ]; then
- b="$(cut -c1-7 "$g/HEAD")..."
- fi
- fi
- fi
+
+ b="$(git symbolic-ref HEAD 2>/dev/null)" || {
+
+ b="$(
+ case "${GIT_PS1_DESCRIBE_STYLE-}" in
+ (contains)
+ git describe --contains HEAD ;;
+ (branch)
+ git describe --contains --all HEAD ;;
+ (describe)
+ git describe HEAD ;;
+ (* | default)
+ git describe --exact-match HEAD ;;
+ esac 2>/dev/null)" ||
+
+ b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
+ b="unknown"
+ b="($b)"
+ }
fi
local w
__git_complete_file
}
+__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
+ tkdiff vimdiff gvimdiff xxdiff
+"
+
+_git_difftool ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --tool=*)
+ __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"
+ return
+ ;;
+ --*)
+ __gitcomp "--tool="
+ return
+ ;;
+ esac
+ COMPREPLY=()
+}
+
__git_fetch_options="
--quiet --verbose --append --upload-pack --force --keep --depth=
--tags --no-tags
"
__git_log_pretty_formats="oneline short medium full fuller email raw format:"
+__git_log_date_formats="relative iso8601 rfc2822 short local default raw"
_git_log ()
{
return
;;
--date=*)
- __gitcomp "
- relative iso8601 rfc2822 short local default
- " "" "${cur##--date=}"
+ __gitcomp "$__git_log_date_formats" "" "${cur##--date=}"
return
;;
--*)
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--tool=*)
- __gitcomp "
- kdiff3 tkdiff meld xxdiff emerge
- vimdiff gvimdiff ecmerge opendiff
- " "" "${cur##--tool=}"
+ __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
return
;;
--*)
__gitcomp "$(__git_refs)"
}
+__git_send_email_confirm_options="always never auto cc compose"
+__git_send_email_suppresscc_options="author self cc ccbody sob cccmd body all"
+
_git_send_email ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
+ --confirm=*)
+ __gitcomp "
+ $__git_send_email_confirm_options
+ " "" "${cur##--confirm=}"
+ return
+ ;;
+ --suppress-cc=*)
+ __gitcomp "
+ $__git_send_email_suppresscc_options
+ " "" "${cur##--suppress-cc=}"
+
+ return
+ ;;
+ --smtp-encryption=*)
+ __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}"
+ return
+ ;;
--*)
__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
- --compose --dry-run --envelope-sender --from --identity
+ --compose --confirm= --dry-run --envelope-sender
+ --from --identity
--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
--no-suppress-from --no-thread --quiet
--signed-off-by-cc --smtp-pass --smtp-server
- --smtp-server-port --smtp-ssl --smtp-user --subject
- --suppress-cc --suppress-from --thread --to
+ --smtp-server-port --smtp-encryption= --smtp-user
+ --subject --suppress-cc= --suppress-from --thread --to
--validate --no-validate"
return
;;
COMPREPLY=()
}
+__git_config_get_set_variables ()
+{
+ local prevword word config_file= c=$COMP_CWORD
+ while [ $c -gt 1 ]; do
+ word="${COMP_WORDS[c]}"
+ case "$word" in
+ --global|--system|--file=*)
+ config_file="$word"
+ break
+ ;;
+ -f|--file)
+ config_file="$word $prevword"
+ break
+ ;;
+ esac
+ prevword=$word
+ c=$((--c))
+ done
+
+ for i in $(git --git-dir="$(__gitdir)" config $config_file --list \
+ 2>/dev/null); do
+ case "$i" in
+ *.*)
+ echo "${i/=*/}"
+ ;;
+ esac
+ done
+}
+
_git_config ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
"
return
;;
+ help.format)
+ __gitcomp "man info web html"
+ return
+ ;;
+ log.date)
+ __gitcomp "$__git_log_date_formats"
+ return
+ ;;
+ sendemail.aliasesfiletype)
+ __gitcomp "mutt mailrc pine elm gnus"
+ return
+ ;;
+ sendemail.confirm)
+ __gitcomp "$__git_send_email_confirm_options"
+ return
+ ;;
+ sendemail.suppresscc)
+ __gitcomp "$__git_send_email_suppresscc_options"
+ return
+ ;;
+ --get|--get-all|--unset|--unset-all)
+ __gitcomp "$(__git_config_get_set_variables)"
+ return
+ ;;
*.*)
COMPREPLY=()
return
__gitcomp "$(__git_heads)" "$pfx" "$cur" "."
return
;;
+ guitool.*.*)
+ local pfx="${cur%.*}."
+ cur="${cur##*.}"
+ __gitcomp "
+ argprompt cmd confirm needsfile noconsole norescan
+ prompt revprompt revunmerged title
+ " "$pfx" "$cur"
+ return
+ ;;
+ difftool.*.*)
+ local pfx="${cur%.*}."
+ cur="${cur##*.}"
+ __gitcomp "cmd path" "$pfx" "$cur"
+ return
+ ;;
+ man.*.*)
+ local pfx="${cur%.*}."
+ cur="${cur##*.}"
+ __gitcomp "cmd path" "$pfx" "$cur"
+ return
+ ;;
+ mergetool.*.*)
+ local pfx="${cur%.*}."
+ cur="${cur##*.}"
+ __gitcomp "cmd path trustExitCode" "$pfx" "$cur"
+ return
+ ;;
+ pager.*)
+ local pfx="${cur%.*}."
+ cur="${cur#*.}"
+ __gitcomp "$(__git_all_commands)" "$pfx" "$cur"
+ return
+ ;;
remote.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
return
;;
+ url.*.*)
+ local pfx="${cur%.*}."
+ cur="${cur##*.}"
+ __gitcomp "insteadof" "$pfx" "$cur"
+ return
+ ;;
esac
__gitcomp "
+ alias.
apply.whitespace
branch.autosetupmerge
branch.autosetuprebase
color.diff.old
color.diff.plain
color.diff.whitespace
+ color.grep
+ color.grep.external
+ color.grep.match
color.interactive
color.interactive.header
color.interactive.help
core.autocrlf
core.bare
core.compression
+ core.createObject
core.deltaBaseCacheLimit
core.editor
core.excludesfile
diff.renameLimit
diff.renameLimit.
diff.renames
+ diff.suppressBlankEmpty
+ diff.tool
+ diff.wordRegex
+ difftool.
+ difftool.prompt
fetch.unpackLimit
+ format.attach
+ format.cc
format.headers
format.numbered
format.pretty
+ format.signoff
+ format.subjectprefix
format.suffix
+ format.thread
gc.aggressiveWindow
gc.auto
gc.autopacklimit
gc.rerereresolved
gc.rerereunresolved
gitcvs.allbinary
+ gitcvs.commitmsgannotation
gitcvs.dbTableNamePrefix
gitcvs.dbdriver
gitcvs.dbname
gitcvs.enabled
gitcvs.logfile
gitcvs.usecrlfattr
+ guitool.
gui.blamehistoryctx
gui.commitmsgwidth
gui.copyblamethreshold
http.sslVerify
i18n.commitEncoding
i18n.logOutputEncoding
+ imap.folder
+ imap.host
+ imap.pass
+ imap.port
+ imap.preformattedHTML
+ imap.sslverify
+ imap.tunnel
+ imap.user
instaweb.browser
instaweb.httpd
instaweb.local
instaweb.modulepath
instaweb.port
+ interactive.singlekey
log.date
log.showroot
+ mailmap.file
+ man.
man.viewer
merge.conflictstyle
merge.log
merge.stat
merge.tool
merge.verbosity
+ mergetool.
mergetool.keepBackup
+ mergetool.prompt
pack.compression
pack.deltaCacheLimit
pack.deltaCacheSize
pack.threads
pack.window
pack.windowMemory
+ pager.
pull.octopus
pull.twohead
+ push.default
+ rebase.stat
receive.denyCurrentBranch
receive.denyDeletes
receive.denyNonFastForwards
repack.usedeltabaseoffset
rerere.autoupdate
rerere.enabled
+ sendemail.aliasesfile
+ sendemail.aliasesfiletype
+ sendemail.bcc
+ sendemail.cc
+ sendemail.cccmd
+ sendemail.chainreplyto
+ sendemail.confirm
+ sendemail.envelopesender
+ sendemail.multiedit
+ sendemail.signedoffbycc
+ sendemail.smtpencryption
+ sendemail.smtppass
+ sendemail.smtpserver
+ sendemail.smtpserverport
+ sendemail.smtpuser
+ sendemail.suppresscc
+ sendemail.suppressfrom
+ sendemail.thread
+ sendemail.to
+ sendemail.validate
showbranch.default
status.relativePaths
status.showUntrackedFiles
tar.umask
transfer.unpackLimit
+ url.
user.email
user.name
user.signingkey
return
;;
--*)
- __gitcomp "--pretty= --format=
+ __gitcomp "--pretty= --format= --abbrev-commit --oneline
$__git_diff_common_options
"
return
__gitcomp "
--all --remotes --topo-order --current --more=
--list --independent --merge-base --no-name
- --sha1-name --topics --reflog
+ --sha1-name --sparse --topics --reflog
"
return
;;
config) _git_config ;;
describe) _git_describe ;;
diff) _git_diff ;;
+ difftool) _git_difftool ;;
fetch) _git_fetch ;;
format-patch) _git_format_patch ;;
fsck) _git_fsck ;;