[PATCH v3 0/3] merge-ort: implement recursive merges
- From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Dec 16, 2020, 17:17 UTC
- Message-ID
- <pull.814.v3.git.1608139034.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.814.v2.git.1608097965.gitgitgadget@gmail.com>
This series depends on en/merge-ort-2 (it does NOT depend on en/merge-ort-3 and can thus be reviewed/merged independently of it).
This short series adds handling of recursive merges (merging of multiple merge-bases to create a virtual merge base) to merge-ort. With this short series the number of test failures under GIT_TEST_MERGE_ALGORITHM=ort drops by 801 (from 1448 to 647).
Changes since v2:
* rename local var from 'next' to 'previous' to make reversing logic clearer (as suggested by Stolee) * employ MAYBE_UNUSED modifier on new functions as better way to avoid unused-function errors (as suggested by Johannes)
Elijah Newren (3): merge-ort: copy a few small helper functions from merge-recursive.c merge-ort: make clear_internal_opts() aware of partial clearing merge-ort: implement merge_incore_recursive()
merge-ort.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++++--- merge-ort.h | 10 ++++ 2 files changed, 152 insertions(+), 7 deletions(-)
base-commit: c5a6f65527aa3b6f5d7cf25437a88d8727ab0646 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-814%2Fnewren%2Fort-recursive-v3 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-814/newren/ort-recursive-v3 Pull-Request: https://github.com/gitgitgadget/git/pull/814
Range-diff vs v2:
1: 0b455bd6fe7 ! 1: dcf28565ad3 merge-ort: copy a few small helper functions from merge-recursive.c
@@ merge-ort.c: void merge_finalize(struct merge_options *opt,
+ c->maybe_tree = t;
+}
+
++MAYBE_UNUSED
+static struct commit *make_virtual_commit(struct repository *repo,
+ struct tree *tree,
+ const char *comment)
@@ merge-ort.c: void merge_finalize(struct merge_options *opt,
+ return commit;
+}
+
++MAYBE_UNUSED
+static struct commit_list *reverse_commit_list(struct commit_list *list)
+{
-+ struct commit_list *next = NULL, *current, *backup;
++ struct commit_list *previous = NULL, *current, *backup;
+ for (current = list; current; current = backup) {
+ backup = current->next;
-+ current->next = next;
-+ next = current;
++ current->next = previous;
++ previous = current;
+ }
-+ return next;
++ return previous;
+}
+
static void merge_start(struct merge_options *opt, struct merge_result *result)
{
/* Sanity checks on opt */
-@@ merge-ort.c: void merge_incore_recursive(struct merge_options *opt,
- struct commit *side2,
- struct merge_result *result)
- {
-+ (void)reverse_commit_list;
-+ (void)make_virtual_commit;
- die("Not yet implemented");
- }
2: fc26c1a11db = 2: bffc45c6570 merge-ort: make clear_internal_opts() aware of partial clearing
3: d8f79450a40 ! 3: 59216a155ae merge-ort: implement merge_incore_recursive()
@@ Commit message
Signed-off-by: Elijah Newren <newren@gmail.com>
## merge-ort.c ##
+@@ merge-ort.c: static inline void set_commit_tree(struct commit *c, struct tree *t)
+ c->maybe_tree = t;
+ }
+
+-MAYBE_UNUSED
+ static struct commit *make_virtual_commit(struct repository *repo,
+ struct tree *tree,
+ const char *comment)
+@@ merge-ort.c: static struct commit *make_virtual_commit(struct repository *repo,
+ return commit;
+ }
+
+-MAYBE_UNUSED
+ static struct commit_list *reverse_commit_list(struct commit_list *list)
+ {
+ struct commit_list *previous = NULL, *current, *backup;
@@ merge-ort.c: static void merge_ort_nonrecursive_internal(struct merge_options *opt,
}
}
@@ merge-ort.c: void merge_incore_recursive(struct merge_options *opt,
struct commit *side2,
struct merge_result *result)
{
-- (void)reverse_commit_list;
-- (void)make_virtual_commit;
- die("Not yet implemented");
+ /*
+ * merge_incore_nonrecursive() exists for cases where we always-- gitgitgadget