phpro / grumphp

A PHP code-quality tool
MIT License
4.14k stars 430 forks source link

"No match for regexp /diff --git (a\/.*) (b\/.*)\n/" if diff.noprefix is true #835

Closed sascha-egerer closed 3 years ago

sascha-egerer commented 3 years ago
Q A
Version 0.22.0
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets #164
$ git commit --amend

In ParserBase.php line 67:

  No match for regexp /diff --git (a\/.*) (b\/.*)\n/ Upcoming: diff --git README.md README.md

git:pre-commit [--skip-success-output] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-c|--config CONFIG] [--] <command>

Steps to reproduce:

# Generate empty folder
mkdir tmp
cd tmp
git init
echo "vendor" > .gitignore
pbpaste > grumphp.yml
composer require --dev phpro/grumphp

# Your actions
# Please add the steps on how to reproduce the issue here.

git config diff.noprefix=true

# Run GrumPHP:
git add -A && git commit -m"Test"

Result:

In ParserBase.php line 67:

  No match for regexp /diff --git (a\/.*) (b\/.*)\n/ Upcoming: diff --git README.md README.md

git:pre-commit [--skip-success-output] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-c|--config CONFIG] [--] <command>
veewee commented 3 years ago

Thanks! Continuing in the PR.

tiagodevweb commented 2 years ago

In my case I solved it by deleting the build folder:

git -c diff.mnemonicprefix=false -c diff.noprefix=false --no-pager diff -r -p -m -M --full-index --no-color --staged -- . ':(exclude)build/*' | cat