thoughtworks / talisman

Using a pre-commit hook, Talisman validates the outgoing changeset for things that look suspicious — such as tokens, passwords, and private keys.
https://thoughtworks.github.io/talisman/
MIT License
1.89k stars 241 forks source link

talisman breaks when gitconfig.diff.noprefix=true #379

Closed revolunet closed 1 year ago

revolunet commented 2 years ago

Describe the bug Talisman 1.28.0 (and below) silently fails if you have this setting in your ~/.gitconfig:

[diff]
  noprefix = true

To Reproduce Add the GIT setting, try to to run talisman pre-commit hook

This result in :

Talisman Scan: 0 <...........................................................................................................................................................................................................................................................................> ?%
Talisman done in 68.989268ms
 TALISMAN >>>>   Check passed!!!!

You can see the progressbar is broken (?%) that's because talisman cant handle the git diff output

Also, errored files are not detected and commited

Expected behavior

Talisman should detect or override such userland setting or warn the user.