Skip to content

Commit 5891c76

Browse files
committed
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 <[email protected]> Acked-by: Victoria Dye <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7cff676 commit 5891c76

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/reset.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,15 @@ static int git_reset_config(const char *var, const char *value, void *cb)
392392
int cmd_reset(int argc, const char **argv, const char *prefix)
393393
{
394394
int reset_type = NONE, update_ref_status = 0, quiet = 0;
395-
int refresh = 1;
395+
int no_refresh = 0;
396396
int patch_mode = 0, pathspec_file_nul = 0, unborn;
397397
const char *rev, *pathspec_from_file = NULL;
398398
struct object_id oid;
399399
struct pathspec pathspec;
400400
int intent_to_add = 0;
401401
const struct option options[] = {
402402
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
403-
OPT_BOOL(0, "refresh", &refresh,
403+
OPT_BOOL(0, "no-refresh", &no_refresh,
404404
N_("skip refreshing the index after reset")),
405405
OPT_SET_INT(0, "mixed", &reset_type,
406406
N_("reset HEAD and index"), MIXED),
@@ -519,7 +519,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
519519
if (read_from_tree(&pathspec, &oid, intent_to_add))
520520
return 1;
521521
the_index.updated_skipworktree = 1;
522-
if (refresh && get_git_work_tree()) {
522+
if (!no_refresh && get_git_work_tree()) {
523523
uint64_t t_begin, t_delta_in_ms;
524524

525525
t_begin = getnanotime();

0 commit comments

Comments
 (0)