threads / patch / 37921

patcht4213: avoid "|" in sed regexp

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

## tl;dr

One message between Nov 10, 2014 and Nov 10, 2014. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Jeff King· Nov 10, 2014, 06:51 UTC · lore
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(-)
Show changes to t/t4213-log-remerge-diff.sh +3 −1
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

← back to recent threads