Skip to content

Commit

Permalink
WIP: remerge-diff: suppress conflict marker labels
Browse files Browse the repository at this point in the history
TODO: Deliberate whether this makes sense only optionally, e.g. with
`range-diff --diff-merges=remerge`. If so: How to do that? Do we need to
avoid the spawned `git log` calls in `range-diff.c` for that, in which
case we face a then-again-premature optimization again that I fixed in
ab75a56 (log: --remerge-diff needs to keep around commit parents,
2024-11-08). Besides, that would need to be refactored into its own
patch as it would otherwise over-extend the scope.

TODO: add a test case that demonstrates how this is useful.

TODO: explain in the commit message why this is useful.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Dec 12, 2024
1 parent eeca09d commit 8c6da01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions log-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ static int do_remerge_diff(struct rev_info *opt,
init_ui_merge_options(&o, the_repository);
o.show_rename_progress = 0;
o.record_conflict_msgs_as_headers = 1;
o.suppress_conflict_labels = 1;
o.msg_header_prefix = "remerge";

ctx.abbrev = DEFAULT_ABBREV;
Expand Down
6 changes: 5 additions & 1 deletion merge-ort.c
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,11 @@ static int merge_3way(struct merge_options *opt,
}

assert(pathnames[0] && pathnames[1] && pathnames[2] && opt->ancestor);
if (pathnames[0] == pathnames[1] && pathnames[1] == pathnames[2]) {
if (opt->suppress_conflict_labels) {
base = xstrdup("");
name1 = xstrdup("");
name2 = xstrdup("");
} else if (pathnames[0] == pathnames[1] && pathnames[1] == pathnames[2]) {
base = mkpathdup("%s", opt->ancestor);
name1 = mkpathdup("%s", opt->branch1);
name2 = mkpathdup("%s", opt->branch2);
Expand Down
1 change: 1 addition & 0 deletions merge-recursive.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct merge_options {
const char *subtree_shift;
unsigned renormalize : 1;
unsigned record_conflict_msgs_as_headers : 1;
unsigned suppress_conflict_labels : 1;
const char *msg_header_prefix;

/* internal fields used by the implementation */
Expand Down

0 comments on commit 8c6da01

Please sign in to comment.