aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/backfill.c2
-rwxr-xr-xt/t5620-backfill.sh15
2 files changed, 16 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,
diff --git a/t/t5620-backfill.sh b/t/t5620-backfill.sh
index 58c81556e7..bed4987124 100755
--- a/t/t5620-backfill.sh
+++ b/t/t5620-backfill.sh
@@ -119,6 +119,21 @@ test_expect_success 'backfill --sparse' '
test_line_count = 0 missing
'
+test_expect_success 'backfill auto-detects sparse-checkout from config' '
+ git clone --sparse --filter=blob:none \
+ --single-branch --branch=main \
+ "file://$(pwd)/srv.bare" backfill-auto-sparse &&
+
+ git -C backfill-auto-sparse rev-list --quiet --objects --missing=print HEAD >missing &&
+ test_line_count = 44 missing &&
+
+ GIT_TRACE2_EVENT="$(pwd)/auto-sparse-trace" git \
+ -C backfill-auto-sparse backfill &&
+
+ test_trace2_data promisor fetch_count 4 <auto-sparse-trace &&
+ test_trace2_data path-walk paths 5 <auto-sparse-trace
+'
+
test_expect_success 'backfill --sparse without cone mode (positive)' '
git clone --no-checkout --filter=blob:none \
--single-branch --branch=main \