mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
Adding commit range feature via 'commit-to' and 'commit-from' options
This commit is contained in:
1 parent
593edeae21
commit
a0f72a4e35
11 files changed
+250
-9
No files matched your search
+7
-1
@@ -339,8 +339,11 @@ func fileMatched(f interface{}, re *regexp.Regexp) bool {
|
||||
// It is similar to `git log {branch}`. Default behavior is to log ALL branches so
|
||||
// gitleaks gets the full git history.
|
||||
func getLogOptions(repo *Repo) (*git.LogOptions, error) {
|
||||
var logOpts git.LogOptions
|
||||
if repo.Manager.Opts.CommitFrom != "" {
|
||||
logOpts.From = plumbing.NewHash(repo.Manager.Opts.CommitFrom)
|
||||
}
|
||||
if repo.Manager.Opts.Branch != "" {
|
||||
var logOpts git.LogOptions
|
||||
refs, err := repo.Storer.IterReferences()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -368,6 +371,9 @@ func getLogOptions(repo *Repo) (*git.LogOptions, error) {
|
||||
}
|
||||
return &logOpts, nil
|
||||
}
|
||||
if !logOpts.From.IsZero() {
|
||||
return &logOpts, nil
|
||||
}
|
||||
return &git.LogOptions{All: true}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user