Switch grep from non-portable BRE to portable ERE
PATCH v2 1/1 Switch grep from non-portable BRE to portable ERE
This makes the grep usage fully POSIX compliant. The ability to enable ERE features in BRE using backslash is a GNU extension.
--- mergetools/vimdiff | 2 +- t/t1404-update-ref-errors.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
mergetools/vimdiff +1 -1
@@ -325,7 +325,7 @@ gen_cmd () { fi # If this is a single window diff with all the buffers - if ! echo "$tab" | grep ",\|/" >/dev/null + if ! echo "$tab" | grep -E ",|/" >/dev/null then CMD="$CMD | silent execute 'bufdo diffthis'" fi
t/t1404-update-ref-errors.sh +1 -1
@@ -100,7 +100,7 @@ df_test() { printf "%s\n" "delete $delname" "create $addname $D" fi >commands && test_must_fail git update-ref --stdin <commands 2>output.err && - grep "fatal:\( cannot lock ref $SQ$addname$SQ:\)\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err && + grep -E "fatal:( cannot lock ref $SQ$addname$SQ:)? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err && printf "%s\n" "$C $delref" >expected-refs && git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && test_cmp expected-refs actual-refs
Quoted 1 line · Marcel Telka
This makes the grep usage fully POSIX compliant. The ability to
Nit: we typically don't say "This commit", of which "This" is another version. Instead, we use imperative style as if instructing the code to change. Also, we typically first explain what the problem is before we say how we fix it.
I don't think this is worth a reroll though, it's only a hint for the next patch you may be sending :)
Quoted 3 lines
enable ERE features in BRE using backslash is a GNU extension.
Signed-off-by Marcel Telka <[email protected]>
It would have been nice if this thread was connected to the thread of your first version so that it's easier to follow the discussion, e.g. by using --in-reply-to= in git-send-email(1) or git-format-patch(1).
But other than that the changes look good to me, thanks!
Patrick
Quoted 32 lines
--- mergetools/vimdiff | 2 +- t/t1404-update-ref-errors.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)mergetools/vimdiff +1
-1@@ -325,7 +325,7 @@ gen_cmd () { fi # If this is a single window diff with all the buffers - if ! echo "$tab" | grep ",\|/" >/dev/null + if ! echo "$tab" | grep -E ",|/" >/dev/null then CMD="$CMD | silent execute 'bufdo diffthis'" fit/t1404-update-ref-errors.sh +1
-1@@ -100,7 +100,7 @@ df_test() { printf "%s\n" "delete $delname" "create $addname $D" fi >commands && test_must_fail git update-ref --stdin <commands 2>output.err && - grep "fatal:\( cannot lock ref $SQ$addname$SQ:\)\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err && + grep -E "fatal:( cannot lock ref $SQ$addname$SQ:)? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err && printf "%s\n" "$C $delref" >expected-refs && git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && test_cmp expected-refs actual-refs
Quoted 11 lines · Patrick Steinhardt
Quoted 1 line · Marcel Telka
This makes the grep usage fully POSIX compliant. The ability to
Nit: we typically don't say "This commit", of which "This" is another version. Instead, we use imperative style as if instructing the code to change. Also, we typically first explain what the problem is before we say how we fix it.
I don't think this is worth a reroll though, it's only a hint for the next patch you may be sending :)
Quoted 7 lines
Quoted 3 lines
enable ERE features in BRE using backslash is a GNU extension.
Signed-off-by Marcel Telka <[email protected]>It would have been nice if this thread was connected to the thread of your first version so that it's easier to follow the discussion, e.g. by using
--in-reply-to=in git-send-email(1) or git-format-patch(1).
Thank you for hints. Really appreciated. This was my first attempt to use the git send-email workflow so it is not surprising I missed the --in-reply-to= option :-).
Best regards.
Signature · 4 lines
+-------------------------------------------+ | Marcel Telka e-mail: [email protected] | | homepage: http://telka.sk/ | +-------------------------------------------+