Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2022-03-01 23:24:30 +0300
committerJunio C Hamano <gitster@pobox.com>2022-03-01 23:36:01 +0300
commitab81047a6c5c4f98640f8a2f56e138367cfdada9 (patch)
tree5d2038e540475bf75cccbf97ef7526f0a3975f4a /builtin/read-tree.c
parent749703924121b9eb2750b4313b2c769113c8b310 (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 'builtin/read-tree.c')
-rw-r--r--builtin/read-tree.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index ec6d038242..9227f07ab1 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -229,11 +229,6 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
opts.fn = opts.prefix ? bind_merge : oneway_merge;
break;
case 2:
- /*
- * TODO: update twoway_merge to handle edit/edit conflicts in
- * sparse directories.
- */
- ensure_full_index(&the_index);
opts.fn = twoway_merge;
opts.initial_checkout = is_cache_unborn();
break;