Commit b501c03
committed
merge-ours: integrate with sparse-index
The merge-ours builtin reads the index only to compare it against HEAD
via index_differs_from(), whose diff machinery (run_diff_index) is
already sparse-aware.
Teach merge-ours to opt out of requiring a full index by setting
command_requires_full_index to 0. Because merge-ours is invoked as a
subprocess by "git merge -s ours" and never previously read config,
the global variables core_apply_sparse_checkout and
core_sparse_checkout_cone remained unset, causing
is_sparse_index_allowed() to return false and the index to be expanded
anyway. Add a repo_config() call with git_default_config to populate
these globals.
Add tests to t1092 verifying that "git merge -s ours" produces
identical results across full-checkout, sparse-checkout, and
sparse-index modes, including verifying the resulting merge commit
structure, and that the sparse index is not expanded during the
operation.
Signed-off-by: Sam Bostock <sam@bostock.ca>1 parent 7265a8f commit b501c03
2 files changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2559 | 2559 | | |
2560 | 2560 | | |
2561 | 2561 | | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
2562 | 2576 | | |
0 commit comments