Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,7 @@ int cmd_fetch(int argc,
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
the_repository->settings.command_requires_fsmonitor = 0;
}

argc = parse_options(argc, argv, prefix,
Expand Down
3 changes: 2 additions & 1 deletion fsmonitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,8 @@ void remove_fsmonitor(struct index_state *istate)
void tweak_fsmonitor(struct index_state *istate)
{
unsigned int i;
int fsmonitor_enabled = (fsm_settings__get_mode(istate->repo)
int fsmonitor_enabled = (istate->repo->settings.command_requires_fsmonitor &&
fsm_settings__get_mode(istate->repo)
> FSMONITOR_MODE_DISABLED);

if (istate->fsmonitor_dirty) {
Expand Down
1 change: 1 addition & 0 deletions repo-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void prepare_repo_settings(struct repository *r)
* removed.
*/
r->settings.command_requires_full_index = 1;
r->settings.command_requires_fsmonitor = 1;

if (!repo_config_get_ulong(r, "core.deltabasecachelimit", &ulongval))
r->settings.delta_base_cache_limit = ulongval;
Expand Down
1 change: 1 addition & 0 deletions repo-settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct repo_settings {
int gc_write_commit_graph;
int fetch_write_commit_graph;
int command_requires_full_index;
int command_requires_fsmonitor;
int sparse_index;
int pack_read_reverse_index;
int pack_use_bitmap_boundary_traversal;
Expand Down
21 changes: 21 additions & 0 deletions t/t7519-status-fsmonitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,25 @@ test_expect_success 'status succeeds with sparse index' '
)
'

test_expect_success "fetch does not activate fsmonitor" '
test_when_finished "rm -rf fsm-repo fsm-upstream" &&

git init fsm-upstream &&
test_commit -C fsm-upstream initial &&

git clone fsm-upstream fsm-repo &&
test_hook -C fsm-repo fsmonitor-test <<-\EOF &&
printf "last_update_token\0"
EOF
git -C fsm-repo config core.fsmonitor .git/hooks/fsmonitor-test &&

GIT_TRACE2_EVENT="$(pwd)/trace2-status.txt" \
git -C fsm-repo status &&
test_region fsm_hook query trace2-status.txt &&

GIT_TRACE2_EVENT="$(pwd)/trace2-fetch.txt" \
git -C fsm-repo fetch origin &&
test_region ! fsm_hook query trace2-fetch.txt
'

test_done
Loading