ggshield
ggshield copied to clipboard
ggshield pre-push scans more commits than necessary
GitGuardian Shield Version
- 1.12.0
Describe the bug
When scanning a new branch, ggshield pre-push hook is not able to detect the branch start and resort to scanning the last N commits (N being 50 by default).
Expected behavior
The hook should only scan the commits between the branch start and the HEAD.
pre-commit supports this (see https://github.com/pre-commit/pre-commit/blob/bdc08d828591b90a3371f6abbaec325a0f36b79d/pre_commit/commands/hook_impl.py#L134). ggshield should do something similar.
TODO
- [ ] Fix the bug for pre-push
- [ ] See if the fix can also be applied to pre-receive. If it's simple: fix it. If it's not, open an issue to fix this on pre-receive.
The attached script (repro-git-push-new-branch.zip) makes it easy to reproduce the bug.
Can you also test this use case on tagging as well