Skip to content

Commit 706caeb

Browse files
committed
added tests for --branch and --since-commit feature
1 parent 1ca9c02 commit 706caeb

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,23 @@ kingfisher scan . \
421421
--branch "$CI_BRANCH"
422422
```
423423

424+
Another example:
425+
```bash
426+
cd /tmp
427+
git clone https://github.com/micksmix/SecretsTest.git
428+
429+
cd /tmp/SecretsTest
430+
git checkout feature-1
431+
#
432+
# scan diff between main and feature-1 branch
433+
kingfisher scan /tmp/SecretsTest --branch feature-1 \
434+
--since-commit=$(git -C /tmp/SecretsTest merge-base main feature-1)
435+
#
436+
# scan only a specific commit
437+
kingfisher scan /tmp/dev/SecretsTest \
438+
--branch baba6ccb453963d3f6136d1ace843e48d7007c3f
439+
```
440+
424441
When the branch under test is already checked out, `--branch HEAD` or omitting `--branch` entirely is sufficient. Kingfisher exits with `200` when any findings are discovered and `205` when validated secrets are present, allowing CI jobs to fail automatically if new credentials slip in.
425442

426443
> **Tip:** You can point Kingfisher at a local working tree and scan another branch or commit without changing checkouts. The CLI now resolves repositories from their worktree roots, so commands like the following work without needing to pass the `.git` directory explicitly:

tests/cli_subcommands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ mod cross_platform {
930930

931931
mod legacy_compatibility {
932932
use super::*;
933-
use std::path::{Path, PathBuf};
933+
use std::path::PathBuf;
934934

935935
#[test]
936936
fn scan_path_still_works() {

0 commit comments

Comments
 (0)