All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fixup! mergetool: add automerge configuration
@ 2021-01-09 21:49 David Aguilar
  2021-01-09 21:59 ` brian m. carlson
  0 siblings, 1 reply; 24+ messages in thread
From: David Aguilar @ 2021-01-09 21:49 UTC (permalink / raw)
  To: Junio C Hamano, Seth House, Felipe Contreras; +Cc: git

The use of "\r\?" in sed is not portable to macOS and possibly
other unix flavors.

Replace "\r" with a substituted variable that contains "\r".
Replace "\?" with "\{0,1\}".

Signed-off-by: David Aguilar <davvid@gmail.com>
---
This is based on top of fc/mergetool-automerge and can be squashed in
(with the addition of my sign-off) if desired.

Let me know if you'd prefer a separate patch. I figured we'd want
a squash to preserve bisectability.

 git-mergetool.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index a44afd3822..12c3e83aa7 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -243,9 +243,16 @@ auto_merge () {
 	git merge-file --diff3 --marker-size=7 -q -p "$LOCAL" "$BASE" "$REMOTE" >"$DIFF3"
 	if test -s "$DIFF3"
 	then
-		sed -e '/^<<<<<<< /,/^||||||| /d' -e '/^=======\r\?$/,/^>>>>>>> /d' "$DIFF3" >"$BASE"
-		sed -e '/^||||||| /,/^>>>>>>> /d' -e '/^<<<<<<< /d' "$DIFF3" >"$LOCAL"
-		sed -e '/^<<<<<<< /,/^=======\r\?$/d' -e '/^>>>>>>> /d' "$DIFF3" >"$REMOTE"
+		cr=$(printf '\x0d')
+		sed -e '/^<<<<<<< /,/^||||||| /d' \
+			-e "/^=======$cr\{0,1\}$/,/^>>>>>>> /d" \
+			"$DIFF3" >"$BASE"
+		sed -e '/^||||||| /,/^>>>>>>> /d' \
+			-e '/^<<<<<<< /d' \
+			"$DIFF3" >"$LOCAL"
+		sed -e "/^<<<<<<< /,/^=======$cr\{0,1\}$/d" \
+			-e '/^>>>>>>> /d' \
+			"$DIFF3" >"$REMOTE"
 	fi
 	rm -- "$DIFF3"
 }
-- 
2.30.0.rc1.6.g2bc636d1d6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-01-29  0:42 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 21:49 [PATCH] fixup! mergetool: add automerge configuration David Aguilar
2021-01-09 21:59 ` brian m. carlson
2021-01-09 22:42   ` [PATCH v2] " David Aguilar
2021-01-09 22:54     ` Seth House
2021-01-10  1:17       ` Junio C Hamano
2021-01-10  6:40         ` Re* " Junio C Hamano
2021-01-10  7:29           ` Seth House
2021-01-10 11:24             ` Junio C Hamano
2021-01-16  4:24               ` Seth House
2021-01-20 23:24                 ` automerge implementation ideas for Windows Seth House
2021-01-21 22:50                   ` Junio C Hamano
2021-01-22  1:09                     ` Seth House
2021-01-22  2:26                       ` Junio C Hamano
2021-01-22  2:50                 ` Re* [PATCH v2] fixup! mergetool: add automerge configuration brian m. carlson
2021-01-22 16:29                   ` Johannes Schindelin
2021-01-22 23:25                     ` brian m. carlson
2021-01-26 14:32                       ` Johannes Schindelin
2021-01-26 18:06                         ` Seth House
2021-01-26 20:10                           ` Junio C Hamano
2021-01-27  3:37                             ` Seth House
2021-01-29  0:41                               ` Junio C Hamano
2021-01-09 23:18     ` Junio C Hamano
2021-01-10  1:52       ` Junio C Hamano
2021-01-09 23:21   ` [PATCH] " Junio C Hamano

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.