mbox series

[v3,0/4] Generic conflict style fixes

Message ID 20230510213738.505241-1-felipe.contreras@gmail.com (mailing list archive)
Headers show
Series Generic conflict style fixes | expand

Message

Felipe Contreras May 10, 2023, 9:37 p.m. UTC
I sent v2 of this series almost 2 years ago [1] and received zero
feedback. This is the same version except rebased on top of master.

In v1 the idea was to change the default conflictstyle, but that
proposal got stuck due to a variety of reasons (including unnecessary
personal drama).

v2 should not have been controversial, and neither is v3.

[1] https://lore.kernel.org/git/20210622002714.1720891-1-felipe.contreras@gmail.com/

Felipe Contreras (4):
  test: add merge style config test
  merge-tree: fix merge.conflictstyle handling
  notes: fix merge.conflictstyle handling
  test: document broken merge.conflictStyle handling

 builtin/merge-tree.c               |   4 +
 builtin/notes.c                    |   3 +-
 t/t6440-config-conflict-markers.sh | 116 +++++++++++++++++++++++++++++
 3 files changed, 122 insertions(+), 1 deletion(-)
 create mode 100755 t/t6440-config-conflict-markers.sh

Range-diff against v2:
1:  51351f1a77 = 1:  6867f22f49 test: add merge style config test
2:  1fccf561ed ! 2:  60bf233000 merge-tree: fix merge.conflictstyle handling
    @@ Commit message
     
      ## builtin/merge-tree.c ##
     @@
    - #include "blob.h"
    - #include "exec-cmd.h"
      #include "merge-blobs.h"
    + #include "quote.h"
    + #include "tree.h"
     +#include "config.h"
     +#include "xdiff-interface.h"
      
    - static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>";
    + static int line_termination = '\n';
      
     @@ builtin/merge-tree.c: int cmd_merge_tree(int argc, const char **argv, const char *prefix)
    - 	if (argc != 4)
    - 		usage(merge_tree_usage);
    + 	if (argc != expected_remaining_argc)
    + 		usage_with_options(merge_tree_usage, mt_options);
      
     +	git_config(git_xmerge_config, NULL);
     +
    - 	buf1 = get_tree_descriptor(r, t+0, argv[1]);
    - 	buf2 = get_tree_descriptor(r, t+1, argv[2]);
    - 	buf3 = get_tree_descriptor(r, t+2, argv[3]);
    + 	/* Do the relevant type of merge */
    + 	if (o.mode == MODE_REAL)
    + 		return real_merge(&o, merge_base, argv[0], argv[1], prefix);
     
      ## t/t6440-config-conflict-markers.sh ##
     @@ t/t6440-config-conflict-markers.sh: test_expect_success 'merge' '
3:  3bb872e3cd ! 3:  cf8cabaae3 notes: fix merge.conflictstyle handling
    @@ Commit message
     
      ## builtin/notes.c ##
     @@
    - #include "notes-merge.h"
      #include "notes-utils.h"
      #include "worktree.h"
    + #include "write-or-die.h"
     +#include "xdiff-interface.h"
      
      static const char * const git_notes_usage[] = {
    @@ builtin/notes.c: int cmd_notes(int argc, const char **argv, const char *prefix)
     -	git_config(git_default_config, NULL);
     +	git_config(git_xmerge_config, NULL);
      	argc = parse_options(argc, argv, prefix, options, git_notes_usage,
    - 			     PARSE_OPT_STOP_AT_NON_OPTION);
    - 
    + 			     PARSE_OPT_SUBCOMMAND_OPTIONAL);
    + 	if (!fn) {
     
      ## t/t6440-config-conflict-markers.sh ##
     @@ t/t6440-config-conflict-markers.sh: test_expect_success 'merge-tree' '
4:  a767bc68e6 = 4:  5959fea3c4 test: document broken merge.conflictStyle handling