# [PATCH] t4213: avoid "|" in sed regexp

1 messages from 2014-11-10 to 2014-11-10. Participants: Jeff King.
Thread: https://gitlist.dev/t/37921

## Jeff King, 2014-11-10 06:51

Subject: [PATCH] t4213: avoid "|" in sed regexp
Message-ID: <20141110065139.GB7677@peff.net>
URL: https://gitlist.dev/e/20141110065139.GB7677%40peff.net

```
On Sun, Nov 09, 2014 at 06:46:01PM -0800, Michael Blume wrote:

> Ok, with that I have a different test failure on the pu branch --
> please tell me if I'm spamming the list or if there's some other
> protocol I should be using to report issues on pu.

No, reporting problems to the list is exactly the right spot. It is nice
to start a new thread, though, if it is an unrelated problem. And
possibly cc folks you think might be responsible. E.g.:

  git shortlog -se origin/master..origin/pu t/t4213-*

points to Thomas. :)

-- >8 --
Many versions of sed (e.g., that found on OS X) do not understand
"|"-alternation, even when backslash escaped.  Some versions can turn on
extended regexps with a special option, but of course that option is not
standard, either. Let's just write out our alternates longhand.

Signed-off-by: Jeff King <peff@peff.net>
---
On top of the tr/remerge-diff topic.

For curiosity, it is "-E" on OS X and "-r" on GNU sed to turn on
extended regexps. But I hear that Solaris sed also does not handle "\|",
and I would not be surprised to find that it has no extended regexp
support at all. :)

 t/t4213-log-remerge-diff.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/t4213-log-remerge-diff.sh b/t/t4213-log-remerge-diff.sh
index 36ef17a..ec93b96 100755
--- a/t/t4213-log-remerge-diff.sh
+++ b/t/t4213-log-remerge-diff.sh
@@ -75,7 +75,9 @@ test_expect_success 'unrelated merge: without conflicts' '
 clean_output () {
 	git name-rev --name-only --stdin |
 	# strip away bits that aren't treated by the above
-	sed -e 's/^\(index\|Merge:\|Date:\).*/\1/'
+	sed -e 's/^\(index\).*/\1/' \
+	    -e 's/^\(Merge:\).*/\1/' \
+	    -e 's/^\(Date:\).*/\1/'
 }
 
 cat >expected <<EOF
-- 
2.1.2.596.g7379948

```
