awslabs / git-secrets

Prevents you from committing secrets and credentials into git repositories
Apache License 2.0
12.36k stars 1.17k forks source link

`git secrets --list` returns wrong result if there's a branch with name ending with `secrets` #159

Open HASHIMOTO-Takafumi opened 4 years ago

HASHIMOTO-Takafumi commented 4 years ago

When there's secrets branch for example, .git/config may contains the following lines:

[branch "secrets"]
        remote = origin
        merge = refs/heads/secrets

If so, git secrets --list returns these config incorrectly:

$ git secrets --list
branch.secrets.remote origin
branch.secrets.merge refs/heads/secrets
...

It seems to be caused by the following regexes:

https://github.com/awslabs/git-secrets/blob/5e28df337746db4f070c84f7069d365bfd0d72a8/git-secrets#L340-L343