Thread (4 messages) flat view 4 messages, 3 authors, 2021-01-09
STALE2051d

[PATCH] fixup! mergetool: add automerge configuration

From: David Aguilar <hidden>
Date: 2021-01-09 21:50:12
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help