aboutsummaryrefslogtreecommitdiff
path: root/builtin/backfill.c
diff options
context:
space:
mode:
authorTrieu Huynh <vikingtc4@gmail.com>2026-04-04 18:15:57 +0700
committerJunio C Hamano <gitster@pobox.com>2026-04-06 09:26:08 -0700
commit339eba65a7f8aa596199e04f45683c48a1562b9c (patch)
treee49d6bb563bfa6e255fd590daf5b2b47d9ab0e3f /builtin/backfill.c
parente565f3755342caf1d21e22359eaf09ec11d8c0ae (diff)
downloadgit-339eba65a7f8aa596199e04f45683c48a1562b9c.tar.xz
backfill: auto-detect sparse-checkout from config
Commit 85127bcdea ("backfill: assume --sparse when sparse-checkout is enabled") intended for 'git backfill' to consult the repository configuration when the user does not pass '--sparse' or '--no-sparse' on the command line. It added the sentinel check: if (ctx->sparse < 0) ctx->sparse = cfg->apply_sparse_checkout; However, the ctx->sparse field is initialized to 0 instead of -1, so this guard never triggers. Consequently, the repository config (core.sparseCheckout) is never checked, and the command always performs a full backfill even when sparse-checkout is enabled. Fix this by initializing ctx->sparse to -1, ensuring the existing fallback logic correctly reads the repository configuration when no explicit flags are provided. Add a test to verify that 'git backfill' automatically respects sparse-checkout settings when no flags are passed. Signed-off-by: Trieu Huynh <vikingtc4@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/backfill.c')
-rw-r--r--builtin/backfill.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/backfill.c b/builtin/backfill.c
index 33e1ea2f84..77d154958c 100644
--- a/builtin/backfill.c
+++ b/builtin/backfill.c
@@ -120,7 +120,7 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
.repo = repo,
.current_batch = OID_ARRAY_INIT,
.min_batch_size = 50000,
- .sparse = 0,
+ .sparse = -1,
};
struct option options[] = {
OPT_INTEGER(0, "min-batch-size", &ctx.min_batch_size,