Skip to content

Commit 32f6788

Browse files
derrickstoleegitster
authored andcommitted
maintenance: respect remote.*.skipFetchAll
If a remote has the skipFetchAll setting enabled, then that remote is not intended for frequent fetching. It makes sense to not fetch that data during the 'prefetch' maintenance task. Skip that remote in the iteration without error. The skip_default_update member is initialized in remote.c:handle_config() as part of initializing the 'struct remote'. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cfd781e commit 32f6788

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

builtin/gc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,9 @@ static int fetch_remote(struct remote *remote, void *cbdata)
878878
struct maintenance_run_opts *opts = cbdata;
879879
struct child_process child = CHILD_PROCESS_INIT;
880880

881+
if (remote->skip_default_update)
882+
return 0;
883+
881884
child.git_cmd = 1;
882885
strvec_pushl(&child.args, "fetch", remote->name,
883886
"--prefetch", "--prune", "--no-tags",

t/t7900-maintenance.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ test_expect_success 'prefetch multiple remotes' '
153153
154154
test_cmp_config refs/prefetch/ log.excludedecoration &&
155155
git log --oneline --decorate --all >log &&
156-
! grep "prefetch" log
156+
! grep "prefetch" log &&
157+
158+
test_when_finished git config --unset remote.remote1.skipFetchAll &&
159+
git config remote.remote1.skipFetchAll true &&
160+
GIT_TRACE2_EVENT="$(pwd)/skip-remote1.txt" git maintenance run --task=prefetch 2>/dev/null &&
161+
test_subcommand ! git fetch remote1 $fetchargs <skip-remote1.txt &&
162+
test_subcommand git fetch remote2 $fetchargs <skip-remote1.txt
157163
'
158164

159165
test_expect_success 'prefetch and existing log.excludeDecoration values' '

0 commit comments

Comments
 (0)