@@ -114,10 +114,7 @@ OPTIONS
--no-refresh::
Proactively refresh the index after a mixed reset. If unspecified, the
behavior falls back on the `reset.refresh` config option. If neither
- `--[no-]refresh` nor `reset.refresh` are set, the default behavior is
- decided by the `--[no-]quiet` option and/or `reset.quiet` config.
- If `--quiet` is specified or `reset.quiet` is set with no command-line
- "quiet" setting, refresh is disabled. Otherwise, refresh is enabled.
+ `--[no-]refresh` nor `reset.refresh` are set, refresh is enabled.
--pathspec-from-file=<file>::
Pathspec is passed in `<file>` instead of commandline args. If
@@ -392,7 +392,7 @@ static int git_reset_config(const char *var, const char *value, void *cb)
int cmd_reset(int argc, const char **argv, const char *prefix)
{
int reset_type = NONE, update_ref_status = 0, quiet = 0;
- int refresh = -1;
+ int refresh = 1;
int patch_mode = 0, pathspec_file_nul = 0, unborn;
const char *rev, *pathspec_from_file = NULL;
struct object_id oid;
@@ -430,13 +430,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
PARSE_OPT_KEEP_DASHDASH);
parse_args(&pathspec, argv, prefix, patch_mode, &rev);
- /*
- * If refresh is completely unspecified (either by config or by command
- * line option), decide based on 'quiet'.
- */
- if (refresh < 0)
- refresh = !quiet;
-
if (pathspec_from_file) {
if (patch_mode)
die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--patch");
@@ -485,25 +485,12 @@ test_reset_refreshes_index () {
}
test_expect_success '--mixed refreshes the index' '
- # Verify default behavior (with no config settings or command line
- # options)
- test_reset_refreshes_index
-'
-test_expect_success '--mixed --[no-]quiet sets default refresh behavior' '
- # Verify that --[no-]quiet and `reset.quiet` (without --[no-]refresh)
- # determine refresh behavior
-
- # Config setting
- ! test_reset_refreshes_index "-c reset.quiet=true" &&
- test_reset_refreshes_index "-c reset.quiet=false" &&
-
- # Command line option
- ! test_reset_refreshes_index "" --quiet &&
- test_reset_refreshes_index "" --no-quiet &&
+ # Verify default behavior (without --[no-]refresh or reset.refresh)
+ test_reset_refreshes_index &&
- # Command line option overrides config setting
- ! test_reset_refreshes_index "-c reset.quiet=false" --quiet &&
- test_reset_refreshes_index "-c reset.refresh=true" --no-quiet
+ # With --quiet & reset.quiet
+ test_reset_refreshes_index "-c reset.quiet=true" &&
+ test_reset_refreshes_index "" --quiet
'
test_expect_success '--mixed --[no-]refresh sets refresh behavior' '
@@ -522,15 +509,6 @@ test_expect_success '--mixed --[no-]refresh sets refresh behavior' '
! test_reset_refreshes_index "-c reset.refresh=true" --no-refresh
'
-test_expect_success '--mixed --refresh overrides --quiet refresh behavior' '
- # Verify that *both* --refresh and `reset.refresh` override the
- # default non-refresh behavior of --quiet
- test_reset_refreshes_index "" "--quiet --refresh" &&
- test_reset_refreshes_index "-c reset.quiet=true" --refresh &&
- test_reset_refreshes_index "-c reset.refresh=true" --quiet &&
- test_reset_refreshes_index "-c reset.refresh=true -c reset.quiet=true"
-'
-
test_expect_success '--mixed preserves skip-worktree' '
echo 123 >>file2 &&
git add file2 &&