All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Phillip Wood <phillip.wood123@gmail.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v2 0/4] Generic conflict style fixes
Date: Mon, 21 Jun 2021 19:27:10 -0500	[thread overview]
Message-ID: <20210622002714.1720891-1-felipe.contreras@gmail.com> (raw)

The switch to diff3 by default got stuck on a tar pit, however that's no
reason not to improve the merge.conflictStyle handling.

I dropped all the controversial changes and focused only on the obvious
improvements.

I switched to from the custom fill function to test_write_lines as Eric
Sunshine suggested, and used a simpler and stricter grep regex for diff3
markers as Phillip Wood prompted.

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 v1:
1:  118388c313 ! 1:  51351f1a77 test: add merge style config test
    @@ t/t6440-config-conflict-markers.sh (new)
     +
     +. ./test-lib.sh
     +
    -+fill () {
    -+	for i
    -+	do
    -+		echo "$i"
    -+	done
    -+}
    -+
     +test_expect_success 'merge' '
     +	test_create_repo merge &&
     +	(
     +		cd merge &&
     +
    -+		fill 1 2 3 >content &&
    ++		test_write_lines 1 2 3 >content &&
     +		git add content &&
     +		git commit -m base &&
     +
    @@ t/t6440-config-conflict-markers.sh (new)
     +		git commit -a -m left &&
     +
     +		test_must_fail git merge r &&
    -+		! grep -E "\|+" content &&
    ++		! grep "^|||||||" content &&
     +
     +		git reset --hard &&
     +		test_must_fail git -c merge.conflictstyle=diff3 merge r &&
    -+		grep -E "\|+" content &&
    ++		grep "^|||||||" content &&
     +
     +		git reset --hard &&
     +		test_must_fail git -c merge.conflictstyle=merge merge r &&
    -+		! grep -E "\|+" content
    ++		! grep "^|||||||" content
     +	)
     +'
     +
2:  697f2a2a5c ! 2:  1fccf561ed merge-tree: fix merge.conflictstyle handling
    @@ t/t6440-config-conflict-markers.sh: test_expect_success 'merge' '
     +		test_commit l content l &&
     +
     +		git merge-tree initial r l >actual &&
    -+		! grep -E "\|+" actual &&
    ++		! grep "^+|||||||" content &&
     +
     +		git -c merge.conflictstyle=diff3 merge-tree initial r l >actual &&
    -+		grep -E "\|+" actual &&
    ++		grep "^+|||||||" actual &&
     +
     +		git -c merge.conflictstyle=merge merge-tree initial r l >actual &&
    -+		! grep -E "\|+" actual
    ++		! grep "^+|||||||" content
     +	)
     +'
     +
3:  56a20f41a4 ! 3:  3bb872e3cd notes: fix merge.conflictstyle handling
    @@ t/t6440-config-conflict-markers.sh: test_expect_success 'merge-tree' '
     +		git notes add -f -m l initial &&
     +
     +		test_must_fail git notes merge r &&
    -+		! grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* &&
    ++		! grep "^|||||||" .git/NOTES_MERGE_WORKTREE/* &&
     +
     +		git notes merge --abort &&
     +		test_must_fail git -c merge.conflictstyle=diff3 notes merge r &&
    -+		grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* &&
    ++		grep "^|||||||" .git/NOTES_MERGE_WORKTREE/* &&
     +
     +		git notes merge --abort &&
     +		test_must_fail git -c merge.conflictstyle=merge notes merge r &&
    -+		! grep -E "\|+" .git/NOTES_MERGE_WORKTREE/*
    ++		! grep "^|||||||" .git/NOTES_MERGE_WORKTREE/*
     +	)
     +'
     +
4:  adce598754 < -:  ---------- checkout: fix merge.conflictstyle handling
5:  a4ddbbc44a < -:  ---------- xdiff: rename XDL_MERGE_STYLE_DIFF3
6:  c3e0940dab < -:  ---------- xdiff: simplify style assignments
7:  6415e53345 < -:  ---------- xdiff: make diff3 the default conflictStyle
-:  ---------- > 4:  a767bc68e6 test: document broken merge.conflictStyle handling
-- 
2.32.0


             reply	other threads:[~2021-06-22  0:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  0:27 Felipe Contreras [this message]
2021-06-22  0:27 ` [PATCH v2 1/4] test: add merge style config test Felipe Contreras
2021-06-22  0:27 ` [PATCH v2 2/4] merge-tree: fix merge.conflictstyle handling Felipe Contreras
2021-06-22  0:27 ` [PATCH v2 3/4] notes: " Felipe Contreras
2021-06-22  0:27 ` [PATCH v2 4/4] test: document broken merge.conflictStyle handling Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210622002714.1720891-1-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood123@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.