diff --git a/apply.c b/apply.c index 892ede5a318f751c80fcceab036a8cbaee391774..f15afa9f6af98ae41af60eb2296ee35d38ccc7fd 100644 --- a/apply.c +++ b/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); } diff --git a/builtin/am.c b/builtin/am.c index 58a2aef28bbcd715660422dc37042e79d4d350c1..e8522450cb3c6e884cead3b8a9ec6fc2acd2a03e 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2119,6 +2119,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; diff --git a/builtin/commit.c b/builtin/commit.c index 2986553d5ffb97f0798e4d4eb921073439fb9a92..b9e396f5e3c3be5e735d46746f8176c623f2e536 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1038,6 +1038,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); } @@ -1179,6 +1183,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); diff --git a/builtin/help.c b/builtin/help.c index 7739a5c1551426fd2302aaf5daa10e454d174195..e5590d7787c50af121db0ba7e6221e89c6785df1 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -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); } diff --git a/builtin/log.c b/builtin/log.c index 57869267d8d75e06a1a34e4dea104102aac21a65..ab859f5904191fd733b852897aac1840aa6dd734 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -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; diff --git a/builtin/pull.c b/builtin/pull.c index 701d1473dc59e018247f337d37f00fe04f83cb98..33db889955402168f95083d741d4094db89cb503 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -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); diff --git a/builtin/replace.c b/builtin/replace.c index 5b80b7f21141d6f85d8444d669dffe289f3a60f5..f5701629a8a5698a64c91ca92226e6da72697441 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -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'"), diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 499e56f83d0a0592abd53686612c79358780eef2..907855184c0ca19ff2d580e6d0de88c979cbf9a3 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -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 "" \ diff --git a/date.c b/date.c index 9c5870e102951ed25f5def2103dab15bf8ed5c99..8126146c5069c9ab9d9f25f1f1bba1323f63cf52 100644 --- a/date.c +++ b/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); } diff --git a/diff.c b/diff.c index 5306c48652db59e84c26383d68cf4a7d896647d4..a1f301b66ce3919dfb970f64ce6aae513a638ee2 100644 --- a/diff.c +++ b/diff.c @@ -178,6 +178,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; @@ -204,6 +208,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; } diff --git a/git-send-email.perl b/git-send-email.perl index 8eb63b5a2f8d07038f6c8ef645a483cd77ffd99f..8200d58cdc62b628f77923305ecb79ff260155ea 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -465,6 +465,8 @@ sub read_config { 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 @@ sub read_config { 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 @@ sub parse_sendmail_aliases { 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}) { diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index b71bd1fb65bc6b9d6c6889b7dcf8d210d57f1e53..c0036f73789d1a6a3ff88a76c3838241e65ca868 100644 --- a/list-objects-filter-options.c +++ b/list-objects-filter-options.c @@ -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); diff --git a/merge-recursive.c b/merge-recursive.c index 4851825aebf29d129aa4b82d860adcbb2697a300..28b36c08f2a8dff017bfb8cbfec5b98ea2e04093 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -3764,6 +3764,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; diff --git a/pretty.c b/pretty.c index 0ab45d10d702373e212fb36e4fa66feb26669ee7..55739a03374322049b75d80f6009d5a6f2a9a85f 100644 --- a/pretty.c +++ b/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; diff --git a/ref-filter.c b/ref-filter.c index 422a9c9ae3fd2cfd552ce48c5e68ce18919b1eb9..cf80d4d69b75d778df90d2e16f7d5762ef86da4f 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -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 } diff --git a/submodule-config.c b/submodule-config.c index 52702c62d9e3a205c14bdd9f468509f98fe4ced1..66653e86b9f87de01332e3d1405edd218cbf1581 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -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 diff --git a/submodule.c b/submodule.c index 934ecfa2943bcb5ee87e7ac431b5332a5f3adcde..b251a81f8efa3f0e2ec9fa435dffb70ac023e1bf 100644 --- a/submodule.c +++ b/submodule.c @@ -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, diff --git a/xdiff-interface.c b/xdiff-interface.c index 80f060d2782e227ce7637a41d05742729c48f6ac..8509f9ea223a1282a367874c3e3a3ef0c351a30f 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -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);