diff options
author | Victoria Dye <vdye@github.com> | 2022-03-01 23:24:30 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-01 23:36:01 +0300 |
commit | ab81047a6c5c4f98640f8a2f56e138367cfdada9 (patch) | |
tree | 5d2038e540475bf75cccbf97ef7526f0a3975f4a /t/t1092-sparse-checkout-compatibility.sh | |
parent | 749703924121b9eb2750b4313b2c769113c8b310 (diff) |
read-tree: make two-way merge sparse-aware
Enable two-way merge with 'git read-tree' without expanding the sparse
index. When in a sparse index, a two-way merge will trivially succeed as
long as there are not changes to the same sparse directory in multiple trees
(i.e., sparse directory-level "edit-edit" conflicts). If there are such
conflicts, the merge will fail despite the possibility that individual files
could merge cleanly.
In order to resolve these "edit-edit" conflicts, "conflicted" sparse
directories are - rather than rejected - merged by traversing their
associated trees by OID. For each child of the sparse directory:
1. Files are merged as normal (see Documentation/git-read-tree.txt for
details).
2. Subdirectories are treated as sparse directories and merged in
'twoway_merge'. If there are no conflicts, they are merged according to
the rules in Documentation/git-read-tree.txt; otherwise, the subdirectory
is recursively traversed and merged.
This process allows sparse directories to be individually merged at the
necessary depth *without* expanding a full index.
The 't/t1092-sparse-checkout-compatibility.sh' test 'read-tree --merge with
edit/edit conflicts in sparse directories' tests two-way merges with 1)
changes inside sparse directories that do not conflict and 2) changes that
do conflict (with the correct file(s) reported in the error message).
Additionally, add two-way merge cases to 'sparse index is not expanded:
read-tree' to confirm that the index is not expanded regardless of whether
edit/edit conflicts are present in a sparse directory.
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1092-sparse-checkout-compatibility.sh')
-rwxr-xr-x | t/t1092-sparse-checkout-compatibility.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index d98558f323..61dc2ea777 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -1413,7 +1413,9 @@ test_expect_success 'sparse index is not expanded: read-tree' ' init_repos && ensure_not_expanded checkout -b test-branch update-folder1 && - for MERGE_TREES in "update-folder2" + for MERGE_TREES in "base update-folder2" \ + "base rename-base" \ + "update-folder2" do ensure_not_expanded read-tree -mu $MERGE_TREES && ensure_not_expanded reset --hard || return 1 |