Skip to content

feat(git,github): add --since date filter to git and github scans#4822

Open
sapasapasapa wants to merge 3 commits intotrufflesecurity:mainfrom
sapasapasapa:feat/git-github-since-date-and-github-max-depth
Open

feat(git,github): add --since date filter to git and github scans#4822
sapasapasapa wants to merge 3 commits intotrufflesecurity:mainfrom
sapasapasapa:feat/git-github-since-date-and-github-max-depth

Conversation

@sapasapasapa
Copy link
Copy Markdown

@sapasapasapa sapasapasapa commented Mar 17, 2026

Description:

Add a --since <date> flag to the git and github subcommands to limit scanning to commits more recent than the specified date (e.g. 2024-01-01).

Internally, the date is passed as --after=<date> to git log via the existing variadic additionalArgs in gitparse.RepoPath. This allows incremental scans where only recent history needs to be checked, avoiding re-scanning the full commit history on each run.

Files changed

File Change
pkg/sources/git/scan_options.go Add SinceDate field and ScanOptionSinceDate option func
pkg/sources/git/git.go Pass SinceDate as --after arg to RepoPath; expose ApplyScanOption for post-Init augmentation
pkg/sources/sources.go Add SinceDate to GitConfig and GithubConfig
pkg/engine/git.go Apply SinceDate scan option after source Init
pkg/engine/github.go Apply SinceDate scan option
main.go Wire --since flag for git and github subcommands

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

Note

Low Risk
Low risk: additive CLI/config plumbing that only narrows the git log commit range via --after, with minimal impact outside git/github scan paths.

Overview
Adds a new --since <date> flag to the git and github subcommands and threads it through sources.GitConfig/sources.GithubConfig into git scanning.

When set, git-based scans now pass --after=<date> into git log (via gitparse.Parser.RepoPath additional args) to restrict scanning to commits newer than the provided date; the git source also gains ScanOptions.SinceDate plus an ApplyScanOption helper to augment options post-Init.

Written by Cursor Bugbot for commit 5f1081a. This will update automatically on new commits. Configure here.

Add a `--since <date>` flag to both the `git` and `github` subcommands
to limit scanning to commits more recent than the specified date. The
date is passed as `--after=<date>` to `git log` via the existing
`additionalArgs` variadic in `gitparse.RepoPath`.

Add a `--max-depth <n>` flag to the `github` subcommand to mirror the
existing flag on the `git` subcommand, capping the number of commits
scanned per repository.

Changes:
- pkg/sources/git/scan_options.go: add SinceDate field and ScanOptionSinceDate option func
- pkg/sources/git/git.go: pass SinceDate as --after arg to RepoPath; expose ApplyScanOption for post-Init augmentation
- pkg/sources/sources.go: add SinceDate to GitConfig and GithubConfig; add MaxDepth to GithubConfig
- pkg/engine/git.go: apply SinceDate scan option after source Init
- pkg/engine/github.go: apply MaxDepth and SinceDate scan options
- main.go: wire --since and --max-depth flags for git and github subcommands

Co-Authored-By: Claude <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 17, 2026

CLA assistant check
All committers have signed the CLA.

The --max-depth flag for GitHub scans was added but never active.
Only the --since date filter is the intended new feature.

Co-Authored-By: Claude <noreply@anthropic.com>
@sapasapasapa sapasapasapa changed the title feat(git,github): add --since date filter and --max-depth for github scan feat(git,github): add --since date filter to git and github scans Mar 17, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@sapasapasapa sapasapasapa marked this pull request as ready for review March 17, 2026 17:24
@sapasapasapa sapasapasapa requested a review from a team March 17, 2026 17:24
@sapasapasapa sapasapasapa requested review from a team as code owners March 17, 2026 17:24
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

Successfully merging this pull request may close these issues.

2 participants