Fix rebuildPatches and grep colors not reverting junk changes

we've seen some index lines change in length in some PR's, though
this script was suppose to ignore those changes already.

The only way I can see that not working is if the color mode
of grep is breaking the pattern matching, as some people
default their grep to use color=always

this adds color=none to ensure colors are disabled, should ensure it.
This commit is contained in:
Aikar 2018-10-10 23:16:18 -04:00
parent f21e10da65
commit e020015aad
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
1 changed files with 2 additions and 2 deletions

View File

@ -14,9 +14,9 @@ function cleanupPatches {
for patch in *.patch; do
echo "$patch"
gitver=$(tail -n 2 "$patch" | grep -ve "^$" | tail -n 1)
diffs=$($gitcmd diff --staged "$patch" | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)")
diffs=$($gitcmd diff --staged "$patch" | grep --color=none -E "^(\+|\-)" | grep --color=none -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|^.index)")
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
testver=$(echo "$diffs" | tail -n 2 | grep --color=none -ve "^$" | tail -n 1 | grep --color=none "$gitver")
if [ "x$testver" != "x" ]; then
diffs=$(echo "$diffs" | sed 'N;$!P;$!D;$d')
fi