Merge branch 'th/backfill-auto-detect-sparseness-fix'

"git backfill" is capable of auto-detecting a sparsely checked out
working tree, which was broken.

* th/backfill-auto-detect-sparseness-fix:
  backfill: auto-detect sparse-checkout from config
This commit is contained in:
Junio C Hamano
2026-04-07 14:59:28 -07:00
2 changed files with 16 additions and 1 deletions

View File

@@ -119,7 +119,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,
.revs = REV_INFO_INIT,
};
struct option options[] = {

View File

@@ -175,6 +175,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 \