diff --git a/builtin/reset.c b/builtin/reset.c index fbf64adf35845c..a67d706a6d96ba 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -459,6 +459,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN; if (read_from_tree(&pathspec, &oid, intent_to_add)) return 1; + the_index.updated_skipworktree = 1; if (!quiet && get_git_work_tree()) { uint64_t t_begin, t_delta_in_ms; @@ -471,7 +472,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix) "use '--quiet' to avoid this. Set the config setting reset.quiet to true\n" "to make this the default.\n"), t_delta_in_ms / 1000.0); } - the_index.updated_skipworktree = 1; } } else { int err = reset_index(&oid, reset_type, quiet); diff --git a/t/t7113-post-index-changed-hook.sh b/t/t7113-post-index-changed-hook.sh index 71e3b2859109c8..5aeb726e375d26 100755 --- a/t/t7113-post-index-changed-hook.sh +++ b/t/t7113-post-index-changed-hook.sh @@ -128,7 +128,7 @@ test_expect_success 'test reset --mixed and update-index triggers the hook' ' EOF : force index to be dirty && test-tool chmtime +60 dir1/file1.txt && - git reset --mixed HEAD~1 && + git reset --mixed --quiet HEAD~1 && test_path_is_file testsuccess && rm -f testsuccess && test_path_is_missing testfailure && git hash-object -w --stdin expect &&