diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-06-18 02:20:55 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-23 01:10:06 +0200 |
commit | 2715e8a931ce1ad3a7bcffbdc6c0e556ae87d158 (patch) | |
tree | f65b58e77dc6185f71097dc073cae17f90e1b08c /merge-ort.c | |
parent | merge-ort: store messages in a list, not in a single strbuf (diff) | |
download | git-2715e8a931ce1ad3a7bcffbdc6c0e556ae87d158.tar.xz git-2715e8a931ce1ad3a7bcffbdc6c0e556ae87d158.zip |
merge-ort: make `path_messages` a strmap to a string_list
This allows us once again to get away with less data copying.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r-- | merge-ort.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/merge-ort.c b/merge-ort.c index 9e9f2fc674..f31c7029ce 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -4371,8 +4371,6 @@ void merge_finalize(struct merge_options *opt, struct merge_result *result) { struct merge_options_internal *opti = result->priv; - struct hashmap_iter iter; - struct strmap_entry *e; if (opt->renormalize) git_attr_set_direction(GIT_ATTR_CHECKIN); @@ -4380,15 +4378,6 @@ void merge_finalize(struct merge_options *opt, clear_or_reinit_internal_opts(opti, 0); FREE_AND_NULL(opti); - - /* Release and free each strbuf found in path_messages */ - strmap_for_each_entry(result->path_messages, &iter, e) { - struct strbuf *buf = e->value; - - strbuf_release(buf); - } - strmap_clear(result->path_messages, 1); - FREE_AND_NULL(result->path_messages); } /*** Function Grouping: helper functions for merge_incore_*() ***/ @@ -4612,8 +4601,6 @@ static void merge_ort_nonrecursive_internal(struct merge_options *opt, struct merge_result *result) { struct object_id working_tree_oid; - struct hashmap_iter iter; - struct strmap_entry *e; if (opt->subtree_shift) { side2 = shift_tree_object(opt->repo, side1, side2, @@ -4654,26 +4641,7 @@ redo: trace2_region_leave("merge", "process_entries", opt->repo); /* Set return values */ - result->path_messages = xcalloc(1, sizeof(*result->path_messages)); - strmap_init_with_options(result->path_messages, NULL, 0); - strmap_for_each_entry(&opt->priv->conflicts, &iter, e) { - const char *path = e->key; - struct strbuf *buf = strmap_get(result->path_messages, path); - struct string_list *conflicts = e->value; - - if (!buf) { - buf = xcalloc(1, sizeof(*buf)); - strbuf_init(buf, 0); - strmap_put(result->path_messages, path, buf); - } - - for (int i = 0; i < conflicts->nr; i++) { - if (buf->len) - strbuf_addch(buf, '\n'); - strbuf_addstr(buf, conflicts->items[i].string); - strbuf_trim_trailing_newline(buf); - } - } + result->path_messages = &opt->priv->conflicts; result->tree = parse_tree_indirect(&working_tree_oid); /* existence of conflicted entries implies unclean */ |