reset: show --no-refresh in the short-help

In the short help output from "git reset -h", the recently added "--[no-]refresh" option is shown like so: --refresh skip refreshing the index after reset which explains what happens when the option is given in the negative form, i.e. "--no-refresh". We could rephrase the explanation to read "refresh the index after reset (default)" to hint that the user can say "--no-refresh" to override the default, but listing the "--no-refresh" form in the list of options would be more helpful. Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Acked-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Mar 24, 2022 at 10:33 UTC 5891c76cd012536a5bb833e512f7262a4b4358c1
1 file changed +3 -3
builtin/reset.c
+3 -3
@@ -392,7 +392,7 @@ static int git_reset_config(const char *var, const char *value, void *cb)
392 int cmd_reset(int argc, const char **argv, const char *prefix)
393 {
394 int reset_type = NONE, update_ref_status = 0, quiet = 0;
395 - int refresh = 1;
395 + int no_refresh = 0;
396 int patch_mode = 0, pathspec_file_nul = 0, unborn;
397 const char *rev, *pathspec_from_file = NULL;
398 struct object_id oid;
@@ -400,7 +400,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
400 int intent_to_add = 0;
401 const struct option options[] = {
402 OPT__QUIET(&quiet, N_("be quiet, only report errors")),
403 - OPT_BOOL(0, "refresh", &refresh,
403 + OPT_BOOL(0, "no-refresh", &no_refresh,
404 N_("skip refreshing the index after reset")),
405 OPT_SET_INT(0, "mixed", &reset_type,
406 N_("reset HEAD and index"), MIXED),
@@ -519,7 +519,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
519 if (read_from_tree(&pathspec, &oid, intent_to_add))
520 return 1;
521 the_index.updated_skipworktree = 1;
522 - if (refresh && get_git_work_tree()) {
522 + if (!no_refresh && get_git_work_tree()) {
523 uint64_t t_begin, t_delta_in_ms;
524
525 t_begin = getnanotime();