mirror of
https://github.com/git/git.git
synced 2025-01-19 14:04:07 +08:00
Merge branch 'nd/completion-more-parameters'
The command line completion (in contrib/) has been taught to complete more subcommand parameters. * nd/completion-more-parameters: completion: add more parameter value completion
This commit is contained in:
commit
b0e7fb2e5c
4
apply.c
4
apply.c
@ -56,6 +56,10 @@ static int parse_whitespace_option(struct apply_state *state, const char *option
|
||||
state->ws_error_action = correct_ws_error;
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Please update $__git_whitespacelist in git-completion.bash
|
||||
* when you add new options.
|
||||
*/
|
||||
return error(_("unrecognized whitespace option '%s'"), option);
|
||||
}
|
||||
|
||||
|
@ -2121,6 +2121,10 @@ static int parse_opt_patchformat(const struct option *opt, const char *arg, int
|
||||
*opt_value = PATCH_FORMAT_HG;
|
||||
else if (!strcmp(arg, "mboxrd"))
|
||||
*opt_value = PATCH_FORMAT_MBOXRD;
|
||||
/*
|
||||
* Please update $__git_patchformat in git-completion.bash
|
||||
* when you add new options
|
||||
*/
|
||||
else
|
||||
return error(_("Invalid value for --patch-format: %s"), arg);
|
||||
return 0;
|
||||
|
@ -1039,6 +1039,10 @@ static void handle_untracked_files_arg(struct wt_status *s)
|
||||
s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
|
||||
else if (!strcmp(untracked_files_arg, "all"))
|
||||
s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
|
||||
/*
|
||||
* Please update $__git_untracked_file_modes in
|
||||
* git-completion.bash when you add new options
|
||||
*/
|
||||
else
|
||||
die(_("Invalid untracked files mode '%s'"), untracked_files_arg);
|
||||
}
|
||||
@ -1180,6 +1184,10 @@ static int parse_and_validate_options(int argc, const char *argv[],
|
||||
else if (!strcmp(cleanup_arg, "scissors"))
|
||||
cleanup_mode = use_editor ? COMMIT_MSG_CLEANUP_SCISSORS :
|
||||
COMMIT_MSG_CLEANUP_SPACE;
|
||||
/*
|
||||
* Please update _git_commit() in git-completion.bash when you
|
||||
* add new options.
|
||||
*/
|
||||
else
|
||||
die(_("Invalid cleanup mode %s"), cleanup_arg);
|
||||
|
||||
|
@ -70,6 +70,10 @@ static enum help_format parse_help_format(const char *format)
|
||||
return HELP_FORMAT_INFO;
|
||||
if (!strcmp(format, "web") || !strcmp(format, "html"))
|
||||
return HELP_FORMAT_WEB;
|
||||
/*
|
||||
* Please update _git_config() in git-completion.bash when you
|
||||
* add new help formats.
|
||||
*/
|
||||
die(_("unrecognized help format '%s'"), format);
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,10 @@ static int parse_decoration_style(const char *value)
|
||||
return DECORATE_SHORT_REFS;
|
||||
else if (!strcmp(value, "auto"))
|
||||
return auto_decoration_style();
|
||||
/*
|
||||
* Please update _git_log() in git-completion.bash when you
|
||||
* add new decoration styles.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1228,6 +1232,10 @@ static int thread_callback(const struct option *opt, const char *arg, int unset)
|
||||
*thread = THREAD_SHALLOW;
|
||||
else if (!strcmp(arg, "deep"))
|
||||
*thread = THREAD_DEEP;
|
||||
/*
|
||||
* Please update _git_formatpatch() in git-completion.bash
|
||||
* when you add new options.
|
||||
*/
|
||||
else
|
||||
return 1;
|
||||
return 0;
|
||||
|
@ -56,6 +56,10 @@ static enum rebase_type parse_config_rebase(const char *key, const char *value,
|
||||
return REBASE_MERGES;
|
||||
else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
|
||||
return REBASE_INTERACTIVE;
|
||||
/*
|
||||
* Please update _git_config() in git-completion.bash when you
|
||||
* add new rebase modes.
|
||||
*/
|
||||
|
||||
if (fatal)
|
||||
die(_("Invalid value for %s: %s"), key, value);
|
||||
|
@ -82,6 +82,10 @@ static int list_replace_refs(const char *pattern, const char *format)
|
||||
data.format = REPLACE_FORMAT_MEDIUM;
|
||||
else if (!strcmp(format, "long"))
|
||||
data.format = REPLACE_FORMAT_LONG;
|
||||
/*
|
||||
* Please update _git_replace() in git-completion.bash when
|
||||
* you add new format
|
||||
*/
|
||||
else
|
||||
return error(_("invalid replace format '%s'\n"
|
||||
"valid formats are 'short', 'medium' and 'long'"),
|
||||
|
@ -853,6 +853,11 @@ __git_compute_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 ()
|
||||
{
|
||||
local dequoted_word pfx ls ref cur_="$cur"
|
||||
@ -996,12 +1001,21 @@ __git_complete_strategy ()
|
||||
-s|--strategy)
|
||||
__gitcomp "$__git_merge_strategies"
|
||||
return 0
|
||||
;;
|
||||
-X)
|
||||
__gitcomp "$__git_merge_strategy_options"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case "$cur" in
|
||||
--strategy=*)
|
||||
__gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"
|
||||
return 0
|
||||
;;
|
||||
--strategy-option=*)
|
||||
__gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
@ -1163,6 +1177,7 @@ __git_count_arguments ()
|
||||
}
|
||||
|
||||
__git_whitespacelist="nowarn warn error error-all fix"
|
||||
__git_patchformat="mbox stgit stgit-series hg mboxrd"
|
||||
__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch"
|
||||
|
||||
_git_am ()
|
||||
@ -1177,6 +1192,10 @@ _git_am ()
|
||||
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
|
||||
return
|
||||
;;
|
||||
--patch-format=*)
|
||||
__gitcomp "$__git_patchformat" "" "${cur##--patch-format=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp_builtin am "" \
|
||||
"$__git_am_inprogress_options"
|
||||
@ -1200,6 +1219,10 @@ _git_apply ()
|
||||
_git_add ()
|
||||
{
|
||||
case "$cur" in
|
||||
--chmod=*)
|
||||
__gitcomp "+x -x" "" "${cur##--chmod=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp_builtin add
|
||||
return
|
||||
@ -1260,6 +1283,8 @@ _git_bisect ()
|
||||
esac
|
||||
}
|
||||
|
||||
__git_ref_fieldlist="refname objecttype objectsize objectname upstream push HEAD symref"
|
||||
|
||||
_git_branch ()
|
||||
{
|
||||
local i c=1 only_local_ref="n" has_r="n"
|
||||
@ -1343,6 +1368,9 @@ _git_cherry_pick ()
|
||||
__gitcomp "$__git_cherry_pick_inprogress_options"
|
||||
return
|
||||
fi
|
||||
|
||||
__git_complete_strategy && return
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
__gitcomp_builtin cherry-pick "" \
|
||||
@ -1506,6 +1534,10 @@ _git_fetch ()
|
||||
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
|
||||
return
|
||||
;;
|
||||
--filter=*)
|
||||
__gitcomp "blob:none blob:limit= sparse:oid= sparse:path=" "" "${cur##--filter=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp_builtin fetch
|
||||
return
|
||||
@ -1702,8 +1734,8 @@ __git_log_shortlog_options="
|
||||
--all-match --invert-grep
|
||||
"
|
||||
|
||||
__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_pretty_formats="oneline short medium full fuller email raw format: mboxrd"
|
||||
__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default raw unix format:"
|
||||
|
||||
_git_log ()
|
||||
{
|
||||
@ -2221,7 +2253,7 @@ _git_config ()
|
||||
return
|
||||
;;
|
||||
diff.submodule)
|
||||
__gitcomp "log short"
|
||||
__gitcomp "$__git_diff_submodule_formats"
|
||||
return
|
||||
;;
|
||||
help.format)
|
||||
@ -2388,6 +2420,10 @@ _git_remote ()
|
||||
_git_replace ()
|
||||
{
|
||||
case "$cur" in
|
||||
--format=*)
|
||||
__gitcomp "short medium long" "" "${cur##--format=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp_builtin replace
|
||||
return
|
||||
@ -2429,6 +2465,7 @@ _git_revert ()
|
||||
__gitcomp "$__git_revert_inprogress_options"
|
||||
return
|
||||
fi
|
||||
__git_complete_strategy && return
|
||||
case "$cur" in
|
||||
--*)
|
||||
__gitcomp_builtin revert "" \
|
||||
|
4
date.c
4
date.c
@ -921,6 +921,10 @@ static enum date_mode_type parse_date_type(const char *format, const char **end)
|
||||
return DATE_UNIX;
|
||||
if (skip_prefix(format, "format", end))
|
||||
return DATE_STRFTIME;
|
||||
/*
|
||||
* Please update $__git_log_date_formats in
|
||||
* git-completion.bash when you add new formats.
|
||||
*/
|
||||
|
||||
die("unknown date format %s", format);
|
||||
}
|
||||
|
8
diff.c
8
diff.c
@ -179,6 +179,10 @@ static int parse_submodule_params(struct diff_options *options, const char *valu
|
||||
options->submodule_format = DIFF_SUBMODULE_SHORT;
|
||||
else if (!strcmp(value, "diff"))
|
||||
options->submodule_format = DIFF_SUBMODULE_INLINE_DIFF;
|
||||
/*
|
||||
* Please update $__git_diff_submodule_formats in
|
||||
* git-completion.bash when you add new formats.
|
||||
*/
|
||||
else
|
||||
return -1;
|
||||
return 0;
|
||||
@ -205,6 +209,10 @@ long parse_algorithm_value(const char *value)
|
||||
return XDF_PATIENCE_DIFF;
|
||||
else if (!strcasecmp(value, "histogram"))
|
||||
return XDF_HISTOGRAM_DIFF;
|
||||
/*
|
||||
* Please update $__git_diff_algorithms in git-completion.bash
|
||||
* when you add new algorithms.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -465,6 +465,8 @@ $smtp_encryption = '' unless (defined $smtp_encryption);
|
||||
my(%suppress_cc);
|
||||
if (@suppress_cc) {
|
||||
foreach my $entry (@suppress_cc) {
|
||||
# Please update $__git_send_email_suppresscc_options
|
||||
# in git-completion.bash when you add new options.
|
||||
die sprintf(__("Unknown --suppress-cc field: '%s'\n"), $entry)
|
||||
unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|misc-by)$/;
|
||||
$suppress_cc{$entry} = 1;
|
||||
@ -494,6 +496,8 @@ my $confirm_unconfigured = !defined $confirm;
|
||||
if ($confirm_unconfigured) {
|
||||
$confirm = scalar %suppress_cc ? 'compose' : 'auto';
|
||||
};
|
||||
# Please update $__git_send_email_confirm_options in
|
||||
# git-completion.bash when you add new options.
|
||||
die sprintf(__("Unknown --confirm setting: '%s'\n"), $confirm)
|
||||
unless $confirm =~ /^(?:auto|cc|compose|always|never)/;
|
||||
|
||||
@ -587,6 +591,8 @@ my %parse_alias = (
|
||||
if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
|
||||
$aliases{$1} = [ $2 ];
|
||||
}}}
|
||||
# Please update _git_config() in git-completion.bash when you
|
||||
# add new MUAs.
|
||||
);
|
||||
|
||||
if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {
|
||||
|
@ -82,6 +82,10 @@ static int gently_parse_list_objects_filter(
|
||||
filter_options->sparse_path_value = strdup(v0);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Please update _git_fetch() in git-completion.bash when you
|
||||
* add new filters
|
||||
*/
|
||||
|
||||
if (errbuf)
|
||||
strbuf_addf(errbuf, "invalid filter-spec '%s'", arg);
|
||||
|
@ -3759,6 +3759,10 @@ int parse_merge_opt(struct merge_options *o, const char *s)
|
||||
return -1;
|
||||
o->merge_detect_rename = 1;
|
||||
}
|
||||
/*
|
||||
* Please update $__git_merge_strategy_options in
|
||||
* git-completion.bash when you add new options
|
||||
*/
|
||||
else
|
||||
return -1;
|
||||
return 0;
|
||||
|
4
pretty.c
4
pretty.c
@ -98,6 +98,10 @@ static void setup_commit_formats(void)
|
||||
{ "fuller", CMIT_FMT_FULLER, 0, 8 },
|
||||
{ "full", CMIT_FMT_FULL, 0, 8 },
|
||||
{ "oneline", CMIT_FMT_ONELINE, 1, 0 }
|
||||
/*
|
||||
* Please update $__git_log_pretty_formats in
|
||||
* git-completion.bash when you add new formats.
|
||||
*/
|
||||
};
|
||||
commit_formats_len = ARRAY_SIZE(builtin_formats);
|
||||
builtin_formats_len = commit_formats_len;
|
||||
|
@ -485,6 +485,10 @@ static struct {
|
||||
{ "if", SOURCE_NONE, FIELD_STR, if_atom_parser },
|
||||
{ "then", SOURCE_NONE },
|
||||
{ "else", SOURCE_NONE },
|
||||
/*
|
||||
* Please update $__git_ref_fieldlist in git-completion.bash
|
||||
* when you add new atoms
|
||||
*/
|
||||
};
|
||||
|
||||
#define REF_FORMATTING_STATE_INIT { 0, NULL }
|
||||
|
@ -281,7 +281,10 @@ static int parse_fetch_recurse(const char *opt, const char *arg,
|
||||
default:
|
||||
if (!strcmp(arg, "on-demand"))
|
||||
return RECURSE_SUBMODULES_ON_DEMAND;
|
||||
|
||||
/*
|
||||
* Please update $__git_fetch_recurse_submodules in
|
||||
* git-completion.bash when you add new options.
|
||||
*/
|
||||
if (die_on_error)
|
||||
die("bad %s argument: %s", opt, arg);
|
||||
else
|
||||
@ -362,6 +365,10 @@ static int parse_push_recurse(const char *opt, const char *arg,
|
||||
return RECURSE_SUBMODULES_CHECK;
|
||||
else if (!strcmp(arg, "only"))
|
||||
return RECURSE_SUBMODULES_ONLY;
|
||||
/*
|
||||
* Please update $__git_push_recurse_submodules in
|
||||
* git-completion.bash when you add new modes.
|
||||
*/
|
||||
else if (die_on_error)
|
||||
die("bad %s argument: %s", opt, arg);
|
||||
else
|
||||
|
@ -432,6 +432,10 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
|
||||
diffopt->flags.ignore_dirty_submodules = 1;
|
||||
else if (strcmp(arg, "none"))
|
||||
die("bad --ignore-submodules argument: %s", arg);
|
||||
/*
|
||||
* Please update _git_status() in git-completion.bash when you
|
||||
* add new options
|
||||
*/
|
||||
}
|
||||
|
||||
static int prepare_submodule_summary(struct rev_info *rev, const char *path,
|
||||
|
@ -306,6 +306,10 @@ int git_xmerge_config(const char *var, const char *value, void *cb)
|
||||
git_xmerge_style = XDL_MERGE_DIFF3;
|
||||
else if (!strcmp(value, "merge"))
|
||||
git_xmerge_style = 0;
|
||||
/*
|
||||
* Please update _git_checkout() in
|
||||
* git-completion.bash when you add new merge config
|
||||
*/
|
||||
else
|
||||
die("unknown style '%s' given for '%s'",
|
||||
value, var);
|
||||
|
Loading…
Reference in New Issue
Block a user