completion/git: Updates completion script to v2.26.2
parent
70e0aa0dcd
commit
f8a1877c72
|
|
@ -1,3 +1,8 @@
|
||||||
|
# git bash completions v2.26.2
|
||||||
|
# Completion file copied as-is from git contrib:
|
||||||
|
# - https://github.com/git/git/releases/tag/v2.26.2
|
||||||
|
# - git-2.26.2/contrib/completion/git-completion.bash
|
||||||
|
# -------------------------------------------------------------------
|
||||||
# bash/zsh completion support for core Git.
|
# bash/zsh completion support for core Git.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
|
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
|
||||||
|
|
@ -37,7 +42,8 @@
|
||||||
# GIT_COMPLETION_CHECKOUT_NO_GUESS
|
# GIT_COMPLETION_CHECKOUT_NO_GUESS
|
||||||
#
|
#
|
||||||
# When set to "1", do not include "DWIM" suggestions in git-checkout
|
# When set to "1", do not include "DWIM" suggestions in git-checkout
|
||||||
# completion (e.g., completing "foo" when "origin/foo" exists).
|
# and git-switch completion (e.g., completing "foo" when "origin/foo"
|
||||||
|
# exists).
|
||||||
|
|
||||||
case "$COMP_WORDBREAKS" in
|
case "$COMP_WORDBREAKS" in
|
||||||
*:*) : great ;;
|
*:*) : great ;;
|
||||||
|
|
@ -339,7 +345,7 @@ __gitcomp ()
|
||||||
c="$c${4-}"
|
c="$c${4-}"
|
||||||
if [[ $c == "$cur_"* ]]; then
|
if [[ $c == "$cur_"* ]]; then
|
||||||
case $c in
|
case $c in
|
||||||
--*=*|*.) ;;
|
--*=|*.) ;;
|
||||||
*) c="$c " ;;
|
*) c="$c " ;;
|
||||||
esac
|
esac
|
||||||
COMPREPLY[i++]="${2-}$c"
|
COMPREPLY[i++]="${2-}$c"
|
||||||
|
|
@ -359,7 +365,7 @@ __gitcomp ()
|
||||||
c="$c${4-}"
|
c="$c${4-}"
|
||||||
if [[ $c == "$cur_"* ]]; then
|
if [[ $c == "$cur_"* ]]; then
|
||||||
case $c in
|
case $c in
|
||||||
--*=*|*.) ;;
|
*=|*.) ;;
|
||||||
*) c="$c " ;;
|
*) c="$c " ;;
|
||||||
esac
|
esac
|
||||||
COMPREPLY[i++]="${2-}$c"
|
COMPREPLY[i++]="${2-}$c"
|
||||||
|
|
@ -400,7 +406,8 @@ __gitcomp_builtin ()
|
||||||
if [ -z "$options" ]; then
|
if [ -z "$options" ]; then
|
||||||
# leading and trailing spaces are significant to make
|
# leading and trailing spaces are significant to make
|
||||||
# option removal work correctly.
|
# option removal work correctly.
|
||||||
options=" $incl $(__git ${cmd/_/ } --git-completion-helper) "
|
options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " || return
|
||||||
|
|
||||||
for i in $excl; do
|
for i in $excl; do
|
||||||
options="${options/ $i / }"
|
options="${options/ $i / }"
|
||||||
done
|
done
|
||||||
|
|
@ -522,7 +529,7 @@ __git_index_files ()
|
||||||
# Even when a directory name itself does not contain
|
# Even when a directory name itself does not contain
|
||||||
# any special characters, it will still be quoted if
|
# any special characters, it will still be quoted if
|
||||||
# any of its (stripped) trailing path components do.
|
# any of its (stripped) trailing path components do.
|
||||||
# Because of this we may have seen the same direcory
|
# Because of this we may have seen the same directory
|
||||||
# both quoted and unquoted.
|
# both quoted and unquoted.
|
||||||
if (p in paths)
|
if (p in paths)
|
||||||
# We have seen the same directory unquoted,
|
# We have seen the same directory unquoted,
|
||||||
|
|
@ -548,7 +555,7 @@ __git_index_files ()
|
||||||
esc_idx, 1)
|
esc_idx, 1)
|
||||||
} else if (esc == "n") {
|
} else if (esc == "n") {
|
||||||
# Uh-oh, a newline character.
|
# Uh-oh, a newline character.
|
||||||
# We cant reliably put a pathname
|
# We cannot reliably put a pathname
|
||||||
# containing a newline into COMPREPLY,
|
# containing a newline into COMPREPLY,
|
||||||
# and the newline would create a mess.
|
# and the newline would create a mess.
|
||||||
# Skip this path.
|
# Skip this path.
|
||||||
|
|
@ -563,7 +570,7 @@ __git_index_files ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Drop closing double quote, if there is one.
|
# Drop closing double quote, if there is one.
|
||||||
# (There isnt any if this is a directory, as it was
|
# (There is not any if this is a directory, as it was
|
||||||
# already stripped with the trailing path components.)
|
# already stripped with the trailing path components.)
|
||||||
if (substr(p, length(p), 1) == "\"")
|
if (substr(p, length(p), 1) == "\"")
|
||||||
out = out substr(p, 1, length(p) - 1)
|
out = out substr(p, 1, length(p) - 1)
|
||||||
|
|
@ -853,6 +860,11 @@ __git_compute_merge_strategies ()
|
||||||
__git_merge_strategies=$(__git_list_merge_strategies)
|
__git_merge_strategies=$(__git_list_merge_strategies)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__git_merge_strategy_options="ours theirs subtree subtree= patience
|
||||||
|
histogram diff-algorithm= ignore-space-change ignore-all-space
|
||||||
|
ignore-space-at-eol renormalize no-renormalize no-renames
|
||||||
|
find-renames find-renames= rename-threshold="
|
||||||
|
|
||||||
__git_complete_revlist_file ()
|
__git_complete_revlist_file ()
|
||||||
{
|
{
|
||||||
local dequoted_word pfx ls ref cur_="$cur"
|
local dequoted_word pfx ls ref cur_="$cur"
|
||||||
|
|
@ -996,12 +1008,21 @@ __git_complete_strategy ()
|
||||||
-s|--strategy)
|
-s|--strategy)
|
||||||
__gitcomp "$__git_merge_strategies"
|
__gitcomp "$__git_merge_strategies"
|
||||||
return 0
|
return 0
|
||||||
|
;;
|
||||||
|
-X)
|
||||||
|
__gitcomp "$__git_merge_strategy_options"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
--strategy=*)
|
--strategy=*)
|
||||||
__gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"
|
__gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
--strategy-option=*)
|
||||||
|
__gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
@ -1010,7 +1031,7 @@ __git_all_commands=
|
||||||
__git_compute_all_commands ()
|
__git_compute_all_commands ()
|
||||||
{
|
{
|
||||||
test -n "$__git_all_commands" ||
|
test -n "$__git_all_commands" ||
|
||||||
__git_all_commands=$(git --list-cmds=main,others,alias,nohelpers)
|
__git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Lists all set config variables starting with the given section prefix,
|
# Lists all set config variables starting with the given section prefix,
|
||||||
|
|
@ -1053,15 +1074,32 @@ __git_aliased_command ()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# __git_find_on_cmdline requires 1 argument
|
# Check whether one of the given words is present on the command line,
|
||||||
|
# and print the first word found.
|
||||||
|
#
|
||||||
|
# Usage: __git_find_on_cmdline [<option>]... "<wordlist>"
|
||||||
|
# --show-idx: Optionally show the index of the found word in the $words array.
|
||||||
__git_find_on_cmdline ()
|
__git_find_on_cmdline ()
|
||||||
{
|
{
|
||||||
local word subcommand c=1
|
local word c=1 show_idx
|
||||||
|
|
||||||
|
while test $# -gt 1; do
|
||||||
|
case "$1" in
|
||||||
|
--show-idx) show_idx=y ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
local wordlist="$1"
|
||||||
|
|
||||||
while [ $c -lt $cword ]; do
|
while [ $c -lt $cword ]; do
|
||||||
word="${words[c]}"
|
for word in $wordlist; do
|
||||||
for subcommand in $1; do
|
if [ "$word" = "${words[c]}" ]; then
|
||||||
if [ "$subcommand" = "$word" ]; then
|
if [ -n "$show_idx" ]; then
|
||||||
echo "$subcommand"
|
echo "$c $word"
|
||||||
|
else
|
||||||
|
echo "$word"
|
||||||
|
fi
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -1163,6 +1201,8 @@ __git_count_arguments ()
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_whitespacelist="nowarn warn error error-all fix"
|
__git_whitespacelist="nowarn warn error error-all fix"
|
||||||
|
__git_patchformat="mbox stgit stgit-series hg mboxrd"
|
||||||
|
__git_showcurrentpatch="diff raw"
|
||||||
__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch"
|
__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch"
|
||||||
|
|
||||||
_git_am ()
|
_git_am ()
|
||||||
|
|
@ -1177,6 +1217,14 @@ _git_am ()
|
||||||
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
|
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
--patch-format=*)
|
||||||
|
__gitcomp "$__git_patchformat" "" "${cur##--patch-format=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
--show-current-patch=*)
|
||||||
|
__gitcomp "$__git_showcurrentpatch" "" "${cur##--show-current-patch=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp_builtin am "" \
|
__gitcomp_builtin am "" \
|
||||||
"$__git_am_inprogress_options"
|
"$__git_am_inprogress_options"
|
||||||
|
|
@ -1200,6 +1248,10 @@ _git_apply ()
|
||||||
_git_add ()
|
_git_add ()
|
||||||
{
|
{
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
|
--chmod=*)
|
||||||
|
__gitcomp "+x -x" "" "${cur##--chmod=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp_builtin add
|
__gitcomp_builtin add
|
||||||
return
|
return
|
||||||
|
|
@ -1225,10 +1277,7 @@ _git_archive ()
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp_builtin archive "--format= --list --verbose --prefix= --worktree-attributes"
|
||||||
--format= --list --verbose
|
|
||||||
--prefix= --remote= --exec= --output
|
|
||||||
"
|
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -1260,6 +1309,8 @@ _git_bisect ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__git_ref_fieldlist="refname objecttype objectsize objectname upstream push HEAD symref"
|
||||||
|
|
||||||
_git_branch ()
|
_git_branch ()
|
||||||
{
|
{
|
||||||
local i c=1 only_local_ref="n" has_r="n"
|
local i c=1 only_local_ref="n" has_r="n"
|
||||||
|
|
@ -1334,7 +1385,9 @@ _git_checkout ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_cherry_pick_inprogress_options="--continue --quit --abort"
|
__git_sequencer_inprogress_options="--continue --quit --abort --skip"
|
||||||
|
|
||||||
|
__git_cherry_pick_inprogress_options=$__git_sequencer_inprogress_options
|
||||||
|
|
||||||
_git_cherry_pick ()
|
_git_cherry_pick ()
|
||||||
{
|
{
|
||||||
|
|
@ -1343,6 +1396,9 @@ _git_cherry_pick ()
|
||||||
__gitcomp "$__git_cherry_pick_inprogress_options"
|
__gitcomp "$__git_cherry_pick_inprogress_options"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
__git_complete_strategy && return
|
||||||
|
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp_builtin cherry-pick "" \
|
__gitcomp_builtin cherry-pick "" \
|
||||||
|
|
@ -1369,7 +1425,18 @@ _git_clean ()
|
||||||
|
|
||||||
_git_clone ()
|
_git_clone ()
|
||||||
{
|
{
|
||||||
|
case "$prev" in
|
||||||
|
-c|--config)
|
||||||
|
__git_complete_config_variable_name_and_value
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
|
--config=*)
|
||||||
|
__git_complete_config_variable_name_and_value \
|
||||||
|
--cur="${cur##--config=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp_builtin clone
|
__gitcomp_builtin clone
|
||||||
return
|
return
|
||||||
|
|
@ -1430,9 +1497,16 @@ __git_diff_algorithms="myers minimal patience histogram"
|
||||||
|
|
||||||
__git_diff_submodule_formats="diff log short"
|
__git_diff_submodule_formats="diff log short"
|
||||||
|
|
||||||
|
__git_color_moved_opts="no default plain blocks zebra dimmed-zebra"
|
||||||
|
|
||||||
|
__git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change
|
||||||
|
ignore-all-space allow-indentation-change"
|
||||||
|
|
||||||
__git_diff_common_options="--stat --numstat --shortstat --summary
|
__git_diff_common_options="--stat --numstat --shortstat --summary
|
||||||
--patch-with-stat --name-only --name-status --color
|
--patch-with-stat --name-only --name-status --color
|
||||||
--no-color --color-words --no-renames --check
|
--no-color --color-words --no-renames --check
|
||||||
|
--color-moved --color-moved= --no-color-moved
|
||||||
|
--color-moved-ws= --no-color-moved-ws
|
||||||
--full-index --binary --abbrev --diff-filter=
|
--full-index --binary --abbrev --diff-filter=
|
||||||
--find-copies-harder --ignore-cr-at-eol
|
--find-copies-harder --ignore-cr-at-eol
|
||||||
--text --ignore-space-at-eol --ignore-space-change
|
--text --ignore-space-at-eol --ignore-space-change
|
||||||
|
|
@ -1446,6 +1520,8 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
|
||||||
--dirstat-by-file= --cumulative
|
--dirstat-by-file= --cumulative
|
||||||
--diff-algorithm=
|
--diff-algorithm=
|
||||||
--submodule --submodule= --ignore-submodules
|
--submodule --submodule= --ignore-submodules
|
||||||
|
--indent-heuristic --no-indent-heuristic
|
||||||
|
--textconv --no-textconv
|
||||||
"
|
"
|
||||||
|
|
||||||
_git_diff ()
|
_git_diff ()
|
||||||
|
|
@ -1461,6 +1537,14 @@ _git_diff ()
|
||||||
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
|
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
--color-moved=*)
|
||||||
|
__gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
--color-moved-ws=*)
|
||||||
|
__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
|
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
|
||||||
--base --ours --theirs --no-index
|
--base --ours --theirs --no-index
|
||||||
|
|
@ -1473,7 +1557,8 @@ _git_diff ()
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
|
__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
|
||||||
tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare
|
tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc
|
||||||
|
codecompare smerge
|
||||||
"
|
"
|
||||||
|
|
||||||
_git_difftool ()
|
_git_difftool ()
|
||||||
|
|
@ -1506,6 +1591,10 @@ _git_fetch ()
|
||||||
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
|
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
--filter=*)
|
||||||
|
__gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp_builtin fetch
|
__gitcomp_builtin fetch
|
||||||
return
|
return
|
||||||
|
|
@ -1620,9 +1709,9 @@ _git_help ()
|
||||||
esac
|
esac
|
||||||
if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
|
if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
|
||||||
then
|
then
|
||||||
__gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(git --list-cmds=alias,list-guide) gitk"
|
__gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"
|
||||||
else
|
else
|
||||||
__gitcomp "$(git --list-cmds=main,nohelpers,alias,list-guide) gitk"
|
__gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1702,8 +1791,8 @@ __git_log_shortlog_options="
|
||||||
--all-match --invert-grep
|
--all-match --invert-grep
|
||||||
"
|
"
|
||||||
|
|
||||||
__git_log_pretty_formats="oneline short medium full fuller email raw format:"
|
__git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
|
||||||
__git_log_date_formats="relative iso8601 rfc2822 short local default raw"
|
__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default raw unix format:"
|
||||||
|
|
||||||
_git_log ()
|
_git_log ()
|
||||||
{
|
{
|
||||||
|
|
@ -1749,6 +1838,10 @@ _git_log ()
|
||||||
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
|
__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
--no-walk=*)
|
||||||
|
__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
$__git_log_common_options
|
$__git_log_common_options
|
||||||
|
|
@ -1756,16 +1849,19 @@ _git_log ()
|
||||||
$__git_log_gitk_options
|
$__git_log_gitk_options
|
||||||
--root --topo-order --date-order --reverse
|
--root --topo-order --date-order --reverse
|
||||||
--follow --full-diff
|
--follow --full-diff
|
||||||
--abbrev-commit --abbrev=
|
--abbrev-commit --no-abbrev-commit --abbrev=
|
||||||
--relative-date --date=
|
--relative-date --date=
|
||||||
--pretty= --format= --oneline
|
--pretty= --format= --oneline
|
||||||
--show-signature
|
--show-signature
|
||||||
--cherry-mark
|
--cherry-mark
|
||||||
--cherry-pick
|
--cherry-pick
|
||||||
--graph
|
--graph
|
||||||
--decorate --decorate=
|
--decorate --decorate= --no-decorate
|
||||||
--walk-reflogs
|
--walk-reflogs
|
||||||
|
--no-walk --no-walk= --do-walk
|
||||||
--parents --children
|
--parents --children
|
||||||
|
--expand-tabs --expand-tabs= --no-expand-tabs
|
||||||
|
--patch
|
||||||
$merge
|
$merge
|
||||||
$__git_diff_common_options
|
$__git_diff_common_options
|
||||||
--pickaxe-all --pickaxe-regex
|
--pickaxe-all --pickaxe-regex
|
||||||
|
|
@ -1969,15 +2065,18 @@ _git_range_diff ()
|
||||||
__git_complete_revlist
|
__git_complete_revlist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__git_rebase_inprogress_options="--continue --skip --abort --quit --show-current-patch"
|
||||||
|
__git_rebase_interactive_inprogress_options="$__git_rebase_inprogress_options --edit-todo"
|
||||||
|
|
||||||
_git_rebase ()
|
_git_rebase ()
|
||||||
{
|
{
|
||||||
__git_find_repo_path
|
__git_find_repo_path
|
||||||
if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
|
if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
|
||||||
__gitcomp "--continue --skip --abort --quit --edit-todo --show-current-patch"
|
__gitcomp "$__git_rebase_interactive_inprogress_options"
|
||||||
return
|
return
|
||||||
elif [ -d "$__git_repo_path"/rebase-apply ] || \
|
elif [ -d "$__git_repo_path"/rebase-apply ] || \
|
||||||
[ -d "$__git_repo_path"/rebase-merge ]; then
|
[ -d "$__git_repo_path"/rebase-merge ]; then
|
||||||
__gitcomp "--continue --skip --abort --quit --show-current-patch"
|
__gitcomp "$__git_rebase_inprogress_options"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
__git_complete_strategy && return
|
__git_complete_strategy && return
|
||||||
|
|
@ -1986,20 +2085,13 @@ _git_rebase ()
|
||||||
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
|
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
--onto=*)
|
||||||
|
__git_complete_refs --cur="${cur##--onto=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp_builtin rebase "" \
|
||||||
--onto --merge --strategy --interactive
|
"$__git_rebase_interactive_inprogress_options"
|
||||||
--rebase-merges --preserve-merges --stat --no-stat
|
|
||||||
--committer-date-is-author-date --ignore-date
|
|
||||||
--ignore-whitespace --whitespace=
|
|
||||||
--autosquash --no-autosquash
|
|
||||||
--fork-point --no-fork-point
|
|
||||||
--autostash --no-autostash
|
|
||||||
--verify --no-verify
|
|
||||||
--keep-empty --root --force-rebase --no-ff
|
|
||||||
--rerere-autoupdate
|
|
||||||
--exec
|
|
||||||
"
|
|
||||||
|
|
||||||
return
|
return
|
||||||
esac
|
esac
|
||||||
|
|
@ -2126,6 +2218,44 @@ _git_status ()
|
||||||
__git_complete_index_file "$complete_opt"
|
__git_complete_index_file "$complete_opt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_git_switch ()
|
||||||
|
{
|
||||||
|
case "$cur" in
|
||||||
|
--conflict=*)
|
||||||
|
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
|
||||||
|
;;
|
||||||
|
--*)
|
||||||
|
__gitcomp_builtin switch
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# check if --track, --no-track, or --no-guess was specified
|
||||||
|
# if so, disable DWIM mode
|
||||||
|
local track_opt="--track" only_local_ref=n
|
||||||
|
if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] ||
|
||||||
|
[ -n "$(__git_find_on_cmdline "--track --no-track --no-guess")" ]; then
|
||||||
|
track_opt=''
|
||||||
|
fi
|
||||||
|
# explicit --guess enables DWIM mode regardless of
|
||||||
|
# $GIT_COMPLETION_CHECKOUT_NO_GUESS
|
||||||
|
if [ -n "$(__git_find_on_cmdline "--guess")" ]; then
|
||||||
|
track_opt='--track'
|
||||||
|
fi
|
||||||
|
if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then
|
||||||
|
only_local_ref=y
|
||||||
|
else
|
||||||
|
# --guess --detach is invalid combination, no
|
||||||
|
# dwim will be done when --detach is specified
|
||||||
|
track_opt=
|
||||||
|
fi
|
||||||
|
if [ $only_local_ref = y -a -z "$track_opt" ]; then
|
||||||
|
__gitcomp_direct "$(__git_heads "" "$cur" " ")"
|
||||||
|
else
|
||||||
|
__git_complete_refs $track_opt
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
__git_config_get_set_variables ()
|
__git_config_get_set_variables ()
|
||||||
{
|
{
|
||||||
local prevword word config_file= c=$cword
|
local prevword word config_file= c=$cword
|
||||||
|
|
@ -2152,181 +2282,282 @@ __git_config_vars=
|
||||||
__git_compute_config_vars ()
|
__git_compute_config_vars ()
|
||||||
{
|
{
|
||||||
test -n "$__git_config_vars" ||
|
test -n "$__git_config_vars" ||
|
||||||
__git_config_vars="$(git help --config-for-completion | sort | uniq)"
|
__git_config_vars="$(git help --config-for-completion | sort -u)"
|
||||||
}
|
}
|
||||||
|
|
||||||
_git_config ()
|
# Completes possible values of various configuration variables.
|
||||||
|
#
|
||||||
|
# Usage: __git_complete_config_variable_value [<option>]...
|
||||||
|
# --varname=<word>: The name of the configuration variable whose value is
|
||||||
|
# to be completed. Defaults to the previous word on the
|
||||||
|
# command line.
|
||||||
|
# --cur=<word>: The current value to be completed. Defaults to the current
|
||||||
|
# word to be completed.
|
||||||
|
__git_complete_config_variable_value ()
|
||||||
{
|
{
|
||||||
local varname
|
local varname="$prev" cur_="$cur"
|
||||||
|
|
||||||
|
while test $# != 0; do
|
||||||
|
case "$1" in
|
||||||
|
--varname=*) varname="${1##--varname=}" ;;
|
||||||
|
--cur=*) cur_="${1##--cur=}" ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
|
if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
|
||||||
varname="${prev,,}"
|
varname="${varname,,}"
|
||||||
else
|
else
|
||||||
varname="$(echo "$prev" |tr A-Z a-z)"
|
varname="$(echo "$varname" |tr A-Z a-z)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$varname" in
|
case "$varname" in
|
||||||
branch.*.remote|branch.*.pushremote)
|
branch.*.remote|branch.*.pushremote)
|
||||||
__gitcomp_nl "$(__git_remotes)"
|
__gitcomp_nl "$(__git_remotes)" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
branch.*.merge)
|
branch.*.merge)
|
||||||
__git_complete_refs
|
__git_complete_refs --cur="$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
branch.*.rebase)
|
branch.*.rebase)
|
||||||
__gitcomp "false true merges preserve interactive"
|
__gitcomp "false true merges preserve interactive" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
remote.pushdefault)
|
remote.pushdefault)
|
||||||
__gitcomp_nl "$(__git_remotes)"
|
__gitcomp_nl "$(__git_remotes)" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
remote.*.fetch)
|
remote.*.fetch)
|
||||||
local remote="${prev#remote.}"
|
local remote="${varname#remote.}"
|
||||||
remote="${remote%.fetch}"
|
remote="${remote%.fetch}"
|
||||||
if [ -z "$cur" ]; then
|
if [ -z "$cur_" ]; then
|
||||||
__gitcomp_nl "refs/heads/" "" "" ""
|
__gitcomp_nl "refs/heads/" "" "" ""
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
__gitcomp_nl "$(__git_refs_remotes "$remote")"
|
__gitcomp_nl "$(__git_refs_remotes "$remote")" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
remote.*.push)
|
remote.*.push)
|
||||||
local remote="${prev#remote.}"
|
local remote="${varname#remote.}"
|
||||||
remote="${remote%.push}"
|
remote="${remote%.push}"
|
||||||
__gitcomp_nl "$(__git for-each-ref \
|
__gitcomp_nl "$(__git for-each-ref \
|
||||||
--format='%(refname):%(refname)' refs/heads)"
|
--format='%(refname):%(refname)' refs/heads)" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
pull.twohead|pull.octopus)
|
pull.twohead|pull.octopus)
|
||||||
__git_compute_merge_strategies
|
__git_compute_merge_strategies
|
||||||
__gitcomp "$__git_merge_strategies"
|
__gitcomp "$__git_merge_strategies" "" "$cur_"
|
||||||
return
|
|
||||||
;;
|
|
||||||
color.branch|color.diff|color.interactive|\
|
|
||||||
color.showbranch|color.status|color.ui)
|
|
||||||
__gitcomp "always never auto"
|
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
color.pager)
|
color.pager)
|
||||||
__gitcomp "false true"
|
__gitcomp "false true" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
color.*.*)
|
color.*.*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
normal black red green yellow blue magenta cyan white
|
normal black red green yellow blue magenta cyan white
|
||||||
bold dim ul blink reverse
|
bold dim ul blink reverse
|
||||||
"
|
" "" "$cur_"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
color.*)
|
||||||
|
__gitcomp "false true always never auto" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
diff.submodule)
|
diff.submodule)
|
||||||
__gitcomp "log short"
|
__gitcomp "$__git_diff_submodule_formats" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
help.format)
|
help.format)
|
||||||
__gitcomp "man info web html"
|
__gitcomp "man info web html" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
log.date)
|
log.date)
|
||||||
__gitcomp "$__git_log_date_formats"
|
__gitcomp "$__git_log_date_formats" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
sendemail.aliasfiletype)
|
sendemail.aliasfiletype)
|
||||||
__gitcomp "mutt mailrc pine elm gnus"
|
__gitcomp "mutt mailrc pine elm gnus" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
sendemail.confirm)
|
sendemail.confirm)
|
||||||
__gitcomp "$__git_send_email_confirm_options"
|
__gitcomp "$__git_send_email_confirm_options" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
sendemail.suppresscc)
|
sendemail.suppresscc)
|
||||||
__gitcomp "$__git_send_email_suppresscc_options"
|
__gitcomp "$__git_send_email_suppresscc_options" "" "$cur_"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
sendemail.transferencoding)
|
sendemail.transferencoding)
|
||||||
__gitcomp "7bit 8bit quoted-printable base64"
|
__gitcomp "7bit 8bit quoted-printable base64" "" "$cur_"
|
||||||
return
|
|
||||||
;;
|
|
||||||
--get|--get-all|--unset|--unset-all)
|
|
||||||
__gitcomp_nl "$(__git_config_get_set_variables)"
|
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
*.*)
|
*.*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
case "$cur" in
|
}
|
||||||
--*)
|
|
||||||
__gitcomp_builtin config
|
# Completes configuration sections, subsections, variable names.
|
||||||
return
|
#
|
||||||
;;
|
# Usage: __git_complete_config_variable_name [<option>]...
|
||||||
|
# --cur=<word>: The current configuration section/variable name to be
|
||||||
|
# completed. Defaults to the current word to be completed.
|
||||||
|
# --sfx=<suffix>: A suffix to be appended to each fully completed
|
||||||
|
# configuration variable name (but not to sections or
|
||||||
|
# subsections) instead of the default space.
|
||||||
|
__git_complete_config_variable_name ()
|
||||||
|
{
|
||||||
|
local cur_="$cur" sfx
|
||||||
|
|
||||||
|
while test $# != 0; do
|
||||||
|
case "$1" in
|
||||||
|
--cur=*) cur_="${1##--cur=}" ;;
|
||||||
|
--sfx=*) sfx="${1##--sfx=}" ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
case "$cur_" in
|
||||||
branch.*.*)
|
branch.*.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur##*.}"
|
local pfx="${cur_%.*}."
|
||||||
__gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_"
|
cur_="${cur_##*.}"
|
||||||
|
__gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
branch.*)
|
branch.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur#*.}"
|
local pfx="${cur%.*}."
|
||||||
|
cur_="${cur#*.}"
|
||||||
__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
|
__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
|
||||||
__gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_"
|
__gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
guitool.*.*)
|
guitool.*.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur##*.}"
|
local pfx="${cur_%.*}."
|
||||||
|
cur_="${cur_##*.}"
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
argPrompt cmd confirm needsFile noConsole noRescan
|
argPrompt cmd confirm needsFile noConsole noRescan
|
||||||
prompt revPrompt revUnmerged title
|
prompt revPrompt revUnmerged title
|
||||||
" "$pfx" "$cur_"
|
" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
difftool.*.*)
|
difftool.*.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur##*.}"
|
local pfx="${cur_%.*}."
|
||||||
__gitcomp "cmd path" "$pfx" "$cur_"
|
cur_="${cur_##*.}"
|
||||||
|
__gitcomp "cmd path" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
man.*.*)
|
man.*.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur##*.}"
|
local pfx="${cur_%.*}."
|
||||||
__gitcomp "cmd path" "$pfx" "$cur_"
|
cur_="${cur_##*.}"
|
||||||
|
__gitcomp "cmd path" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
mergetool.*.*)
|
mergetool.*.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur##*.}"
|
local pfx="${cur_%.*}."
|
||||||
__gitcomp "cmd path trustExitCode" "$pfx" "$cur_"
|
cur_="${cur_##*.}"
|
||||||
|
__gitcomp "cmd path trustExitCode" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
pager.*)
|
pager.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur#*.}"
|
local pfx="${cur_%.*}."
|
||||||
|
cur_="${cur_#*.}"
|
||||||
__git_compute_all_commands
|
__git_compute_all_commands
|
||||||
__gitcomp_nl "$__git_all_commands" "$pfx" "$cur_"
|
__gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
remote.*.*)
|
remote.*.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur##*.}"
|
local pfx="${cur_%.*}."
|
||||||
|
cur_="${cur_##*.}"
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
url proxy fetch push mirror skipDefaultUpdate
|
url proxy fetch push mirror skipDefaultUpdate
|
||||||
receivepack uploadpack tagOpt pushurl
|
receivepack uploadpack tagOpt pushurl
|
||||||
" "$pfx" "$cur_"
|
" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
remote.*)
|
remote.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur#*.}"
|
local pfx="${cur_%.*}."
|
||||||
|
cur_="${cur_#*.}"
|
||||||
__gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
|
__gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
|
||||||
__gitcomp_nl_append "pushDefault" "$pfx" "$cur_"
|
__gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
url.*.*)
|
url.*.*)
|
||||||
local pfx="${cur%.*}." cur_="${cur##*.}"
|
local pfx="${cur_%.*}."
|
||||||
__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
|
cur_="${cur_##*.}"
|
||||||
|
__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" "$sfx"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
*.*)
|
*.*)
|
||||||
__git_compute_config_vars
|
__git_compute_config_vars
|
||||||
__gitcomp "$__git_config_vars"
|
__gitcomp "$__git_config_vars" "" "$cur_" "$sfx"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
__git_compute_config_vars
|
__git_compute_config_vars
|
||||||
__gitcomp "$(echo "$__git_config_vars" | sed 's/\.[^ ]*/./g')"
|
__gitcomp "$(echo "$__git_config_vars" |
|
||||||
|
awk -F . '{
|
||||||
|
sections[$1] = 1
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
for (s in sections)
|
||||||
|
print s "."
|
||||||
|
}
|
||||||
|
')" "" "$cur_"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Completes '='-separated configuration sections/variable names and values
|
||||||
|
# for 'git -c section.name=value'.
|
||||||
|
#
|
||||||
|
# Usage: __git_complete_config_variable_name_and_value [<option>]...
|
||||||
|
# --cur=<word>: The current configuration section/variable name/value to be
|
||||||
|
# completed. Defaults to the current word to be completed.
|
||||||
|
__git_complete_config_variable_name_and_value ()
|
||||||
|
{
|
||||||
|
local cur_="$cur"
|
||||||
|
|
||||||
|
while test $# != 0; do
|
||||||
|
case "$1" in
|
||||||
|
--cur=*) cur_="${1##--cur=}" ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
case "$cur_" in
|
||||||
|
*=*)
|
||||||
|
__git_complete_config_variable_value \
|
||||||
|
--varname="${cur_%%=*}" --cur="${cur_#*=}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
__git_complete_config_variable_name --cur="$cur_" --sfx='='
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_git_config ()
|
||||||
|
{
|
||||||
|
case "$prev" in
|
||||||
|
--get|--get-all|--unset|--unset-all)
|
||||||
|
__gitcomp_nl "$(__git_config_get_set_variables)"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*.*)
|
||||||
|
__git_complete_config_variable_value
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp_builtin config
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
__git_complete_config_variable_name
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2388,6 +2619,10 @@ _git_remote ()
|
||||||
_git_replace ()
|
_git_replace ()
|
||||||
{
|
{
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
|
--format=*)
|
||||||
|
__gitcomp "short medium long" "" "${cur##--format=}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp_builtin replace
|
__gitcomp_builtin replace
|
||||||
return
|
return
|
||||||
|
|
@ -2420,7 +2655,22 @@ _git_reset ()
|
||||||
__git_complete_refs
|
__git_complete_refs
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_revert_inprogress_options="--continue --quit --abort"
|
_git_restore ()
|
||||||
|
{
|
||||||
|
case "$cur" in
|
||||||
|
--conflict=*)
|
||||||
|
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
|
||||||
|
;;
|
||||||
|
--source=*)
|
||||||
|
__git_complete_refs --cur="${cur##--source=}"
|
||||||
|
;;
|
||||||
|
--*)
|
||||||
|
__gitcomp_builtin restore
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_revert_inprogress_options=$__git_sequencer_inprogress_options
|
||||||
|
|
||||||
_git_revert ()
|
_git_revert ()
|
||||||
{
|
{
|
||||||
|
|
@ -2429,6 +2679,7 @@ _git_revert ()
|
||||||
__gitcomp "$__git_revert_inprogress_options"
|
__gitcomp "$__git_revert_inprogress_options"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
__git_complete_strategy && return
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp_builtin revert "" \
|
__gitcomp_builtin revert "" \
|
||||||
|
|
@ -2487,8 +2738,9 @@ _git_show ()
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--pretty= --format= --abbrev-commit --oneline
|
__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
|
||||||
--show-signature
|
--oneline --show-signature --patch
|
||||||
|
--expand-tabs --expand-tabs= --no-expand-tabs
|
||||||
$__git_diff_common_options
|
$__git_diff_common_options
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
|
|
@ -2508,6 +2760,27 @@ _git_show_branch ()
|
||||||
__git_complete_revlist
|
__git_complete_revlist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_git_sparse_checkout ()
|
||||||
|
{
|
||||||
|
local subcommands="list init set disable"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$subcommand,$cur" in
|
||||||
|
init,--*)
|
||||||
|
__gitcomp "--cone"
|
||||||
|
;;
|
||||||
|
set,--*)
|
||||||
|
__gitcomp "--stdin"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_git_stash ()
|
_git_stash ()
|
||||||
{
|
{
|
||||||
local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
|
local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
|
||||||
|
|
@ -2573,7 +2846,7 @@ _git_submodule ()
|
||||||
{
|
{
|
||||||
__git_has_doubledash && return
|
__git_has_doubledash && return
|
||||||
|
|
||||||
local subcommands="add status init deinit update summary foreach sync"
|
local subcommands="add status init deinit update set-branch set-url summary foreach sync absorbgitdirs"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]; then
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
|
|
@ -2604,6 +2877,9 @@ _git_submodule ()
|
||||||
--force --rebase --merge --reference --depth --recursive --jobs
|
--force --rebase --merge --reference --depth --recursive --jobs
|
||||||
"
|
"
|
||||||
;;
|
;;
|
||||||
|
set-branch,--*)
|
||||||
|
__gitcomp "--default --branch"
|
||||||
|
;;
|
||||||
summary,--*)
|
summary,--*)
|
||||||
__gitcomp "--cached --files --summary-limit"
|
__gitcomp "--cached --files --summary-limit"
|
||||||
;;
|
;;
|
||||||
|
|
@ -2634,6 +2910,7 @@ _git_svn ()
|
||||||
--log-window-size= --no-checkout --quiet
|
--log-window-size= --no-checkout --quiet
|
||||||
--repack-flags --use-log-author --localtime
|
--repack-flags --use-log-author --localtime
|
||||||
--add-author-from
|
--add-author-from
|
||||||
|
--recursive
|
||||||
--ignore-paths= --include-paths= $remote_opts
|
--ignore-paths= --include-paths= $remote_opts
|
||||||
"
|
"
|
||||||
local init_opts="
|
local init_opts="
|
||||||
|
|
@ -2755,33 +3032,83 @@ _git_whatchanged ()
|
||||||
_git_log
|
_git_log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__git_complete_worktree_paths ()
|
||||||
|
{
|
||||||
|
local IFS=$'\n'
|
||||||
|
__gitcomp_nl "$(git worktree list --porcelain |
|
||||||
|
# Skip the first entry: it's the path of the main worktree,
|
||||||
|
# which can't be moved, removed, locked, etc.
|
||||||
|
sed -n -e '2,$ s/^worktree //p')"
|
||||||
|
}
|
||||||
|
|
||||||
_git_worktree ()
|
_git_worktree ()
|
||||||
{
|
{
|
||||||
local subcommands="add list lock move prune remove unlock"
|
local subcommands="add list lock move prune remove unlock"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand subcommand_idx
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
|
subcommand="$(__git_find_on_cmdline --show-idx "$subcommands")"
|
||||||
|
subcommand_idx="${subcommand% *}"
|
||||||
|
subcommand="${subcommand#* }"
|
||||||
|
|
||||||
|
case "$subcommand,$cur" in
|
||||||
|
,*)
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
else
|
;;
|
||||||
case "$subcommand,$cur" in
|
*,--*)
|
||||||
add,--*)
|
__gitcomp_builtin worktree_$subcommand
|
||||||
__gitcomp_builtin worktree_add
|
;;
|
||||||
|
add,*) # usage: git worktree add [<options>] <path> [<commit-ish>]
|
||||||
|
# Here we are not completing an --option, it's either the
|
||||||
|
# path or a ref.
|
||||||
|
case "$prev" in
|
||||||
|
-b|-B) # Complete refs for branch to be created/reseted.
|
||||||
|
__git_complete_refs
|
||||||
;;
|
;;
|
||||||
list,--*)
|
-*) # The previous word is an -o|--option without an
|
||||||
__gitcomp_builtin worktree_list
|
# unstuck argument: have to complete the path for
|
||||||
|
# the new worktree, so don't list anything, but let
|
||||||
|
# Bash fall back to filename completion.
|
||||||
;;
|
;;
|
||||||
lock,--*)
|
*) # The previous word is not an --option, so it must
|
||||||
__gitcomp_builtin worktree_lock
|
# be either the 'add' subcommand, the unstuck
|
||||||
;;
|
# argument of an option (e.g. branch for -b|-B), or
|
||||||
prune,--*)
|
# the path for the new worktree.
|
||||||
__gitcomp_builtin worktree_prune
|
if [ $cword -eq $((subcommand_idx+1)) ]; then
|
||||||
;;
|
# Right after the 'add' subcommand: have to
|
||||||
remove,--*)
|
# complete the path, so fall back to Bash
|
||||||
__gitcomp "--force"
|
# filename completion.
|
||||||
;;
|
:
|
||||||
*)
|
else
|
||||||
|
case "${words[cword-2]}" in
|
||||||
|
-b|-B) # After '-b <branch>': have to
|
||||||
|
# complete the path, so fall back
|
||||||
|
# to Bash filename completion.
|
||||||
|
;;
|
||||||
|
*) # After the path: have to complete
|
||||||
|
# the ref to be checked out.
|
||||||
|
__git_complete_refs
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
;;
|
||||||
|
lock,*|remove,*|unlock,*)
|
||||||
|
__git_complete_worktree_paths
|
||||||
|
;;
|
||||||
|
move,*)
|
||||||
|
if [ $cword -eq $((subcommand_idx+1)) ]; then
|
||||||
|
# The first parameter must be an existing working
|
||||||
|
# tree to be moved.
|
||||||
|
__git_complete_worktree_paths
|
||||||
|
else
|
||||||
|
# The second parameter is the destination: it could
|
||||||
|
# be any path, so don't list anything, but let Bash
|
||||||
|
# fall back to filename completion.
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_complete_common () {
|
__git_complete_common () {
|
||||||
|
|
@ -2860,7 +3187,11 @@ __git_main ()
|
||||||
# Bash filename completion
|
# Bash filename completion
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
-c|--namespace)
|
-c)
|
||||||
|
__git_complete_config_variable_name_and_value
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
--namespace)
|
||||||
# we don't support completing these options' arguments
|
# we don't support completing these options' arguments
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
|
@ -2888,7 +3219,7 @@ __git_main ()
|
||||||
then
|
then
|
||||||
__gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
|
__gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
|
||||||
else
|
else
|
||||||
__gitcomp "$(git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"
|
__gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue