Skip to content

Commit

Permalink
test: avoid + in sed for portability
Browse files Browse the repository at this point in the history
Replacing ' +' with '  *' works with BSD sed's dumb regexes.
  • Loading branch information
jpgrayson committed Oct 5, 2023
1 parent 66e3317 commit 3546ef2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions t/t3300-edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ test_expect_success 'Edit patch diff which fails to apply' '

test_expect_success 'Edit patch name of top patch' '
write_script diffedit <<-\EOF &&
sed "s/^Patch: \\+p2/Patch: p2-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
sed "s/^Patch: *p2/Patch: p2-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
EOF
test_when_finished "rm -f diffedit" &&
EDITOR=./diffedit stg edit -d &&
Expand All @@ -237,7 +237,7 @@ test_expect_success 'Edit patch name of top patch' '

test_expect_success 'Edit patch name of non-top applied patch' '
write_script diffedit <<-\EOF &&
sed "s/^Patch: \\+p1/Patch: p1-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
sed "s/^Patch: *p1/Patch: p1-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
EOF
test_when_finished "rm -f diffedit" &&
EDITOR=./diffedit stg edit -d p1 &&
Expand All @@ -248,7 +248,7 @@ test_expect_success 'Edit patch name of non-top applied patch' '

test_expect_success 'Edit patch name of non-applied patch' '
write_script diffedit <<-\EOF &&
sed "s/^Patch: \\+p3/Patch: p3-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
sed "s/^Patch: *p3/Patch: p3-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
EOF
test_when_finished "rm -f diffedit" &&
EDITOR=./diffedit stg edit -d p3 &&
Expand All @@ -259,7 +259,7 @@ test_expect_success 'Edit patch name of non-applied patch' '

test_expect_success 'Edit patch name of hidden patch' '
write_script diffedit <<-\EOF &&
sed "s/^Patch: \\+p4/Patch: p4-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
sed "s/^Patch: *p4/Patch: p4-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
EOF
test_when_finished "rm -f diffedit" &&
EDITOR=./diffedit stg edit -d p4 &&
Expand All @@ -269,7 +269,7 @@ test_expect_success 'Edit patch name of hidden patch' '

test_expect_success 'Clearing the patch name results in a new autogenerated name' '
write_script diffedit <<-\EOF &&
sed "s/^Patch: \\+p2/Patch:/" "$1" >"$1".tmp && mv "$1".tmp "$1"
sed "s/^Patch: *p2/Patch:/" "$1" >"$1".tmp && mv "$1".tmp "$1"
EOF
test_when_finished "rm -f diffedit" &&
EDITOR=./diffedit stg edit -d &&
Expand All @@ -280,7 +280,7 @@ test_expect_success 'Clearing the patch name results in a new autogenerated name

test_expect_success 'Rename patch and edit its diff' '
write_script diffedit <<-\EOF &&
sed -e "s/^Patch: \\+p2/Patch: p2-new/" -e "s/twoliner/twoliner-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
sed -e "s/^Patch: *p2/Patch: p2-new/" -e "s/twoliner/twoliner-new/" "$1" >"$1".tmp && mv "$1".tmp "$1"
EOF
test_when_finished "rm -f diffedit" &&
EDITOR=./diffedit stg edit -d &&
Expand Down

0 comments on commit 3546ef2

Please sign in to comment.