merge-ours: sparse-index integration#2041
Closed
sambostock wants to merge 2 commits intogitgitgadget:masterfrom
Closed
merge-ours: sparse-index integration#2041sambostock wants to merge 2 commits intogitgitgadget:masterfrom
sambostock wants to merge 2 commits intogitgitgadget:masterfrom
Conversation
Use the `repo` parameter passed to cmd_merge_ours() instead of `the_repository`, and drop the USE_THE_REPOSITORY_VARIABLE macro that is no longer needed. While at it, remove a stray double blank line between the #include block and the usage string. Signed-off-by: Sam Bostock <sam@sambostock.ca>
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@sambostock.ca>
b501c03 to
20b9e0b
Compare
Author
|
Opened against wrong repo. Re-opening against git/git. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This short series teaches merge-ours to work with a sparse index.
Patch 1 is a preparatory cleanup that converts merge-ours away from
the_repository global, using the
repoparameter instead.Patch 2 adds the actual sparse-index integration and tests. Because
merge-ours is invoked as a subprocess by
git merge -s oursand neverpreviously read config, the sparse-checkout globals remained unset,
causing the index to be expanded unconditionally. A
repo_config()callfixes this.
Developed with AI assistance (Claude).