Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on bash 4 during pre-commit hook #45

Closed
bruecktech opened this issue Apr 25, 2017 · 9 comments
Closed

Fails on bash 4 during pre-commit hook #45

bruecktech opened this issue Apr 25, 2017 · 9 comments

Comments

@bruecktech
Copy link

Hello,

we noticed a problem on bash 4 when multiple files have been changed by a commit.
When getting called in a pre-commit hook we get this error:

fatal: ambiguous argument 'slides/Container_Network_Model/Body.md slides/Container_Network_Model/Cover.md': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'

On bash 3 it works.

It seems like in bash 4 the files argument is passed to the git_grep function with quotes
git grep -nwHEI --cached '...mypattern...' 'slides/Container_Network_Model/Body.md slides/Container_Network_Model/Cover.md'

in bash 3 the quotes are not there
git grep -nwHEI --cached '...mypattern...' slides/Container_Network_Model/Body.md slides/Container_Network_Model/Cover.md

@WintersMichael
Copy link

WintersMichael commented May 30, 2017

I'm seeing this same issue on OSX with git-secrets 1.2.1 (from homebrew) under zsh 5.0.8 (also from homebrew). I have bash 4.4.12 installed as well.

@ricoli
Copy link

ricoli commented Jun 26, 2017

ping @mtdowling: doesn't look like Travis has been running the tests, or at least not on bash 4 - I get 3 failures when running the tests locally using bash 4, and the output is just like what is described here.
✗ Rejects commits with prohibited patterns in changeset
✗ Scans staged files
✗ Rejects commits with prohibited patterns in changeset when AWS provider is enabled

@mtdowling
Copy link
Contributor

I've been looking into this and seeing if I can get a Travis build matrix setup to test against bash 4. I made some progress, but there's still work to be done to get the full matrix actually working an passing.

I'll keep working at this. Let me know if you or anyone else has feedback on the approach or fixes that can be made.

ssteo pushed a commit to ssteo/git-secrets that referenced this issue Sep 8, 2017
This PR fixes the issue described here.
awslabs#45 (comment)
@ssteo
Copy link
Contributor

ssteo commented Sep 8, 2017

This PR should fix the pre-commit hook error
#54

@bjeanes
Copy link

bjeanes commented Dec 1, 2017

Just hit this as well. Is #54 going to be merged?

@anna64000
Copy link

Ok thanks

@ssteo
Copy link
Contributor

ssteo commented Dec 5, 2017

Can the maintainers merge this PR please?

@mtdowling
Copy link
Contributor

Fixed via #54

@Eyal-Shalev
Copy link

#54 Does not fix this issue
Running GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)
Git Secrets installed via Homebrew git-secrets: stable 1.2.1 (bottled), HEAD

Committing a single file (with aws secret) will result in the warning.
Committing multiple files that one of them includes the aws secret will produce the error seen in #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants