Skip to contentSkip to conversation

t4213: avoid "|" in sed regexp

PATCH New Jeff King 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore

Jeff King

author
#0 lore raw

PATCH 1/1 t4213: avoid "|" in sed regexp

Quoted 3 lines · Michael Blume

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.

---
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(-)
t/t4213-log-remerge-diff.sh +3 -1
index 36ef17a..ec93b96 100755
@@ -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
Signature · 1 line
2.1.2.596.g7379948