Просмотр исходного кода

Allow use of --repo-config for AuditUncommitted function

Peter Gallagher 6 лет назад
Родитель
Сommit
9b3342fbff
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      audit/repo.go

+ 9 - 0
audit/repo.go

@@ -84,6 +84,15 @@ func (repo *Repo) Clone(cloneOption *git.CloneOptions) error {
 // AuditUncommitted will do a `git diff` and scan changed files that are being tracked. This is useful functionality
 // for a pre-commit hook so you can make sure your code does not have any leaks before committing.
 func (repo *Repo) AuditUncommitted() error {
+	// load up alternative config if possible, if not use manager's config
+	if repo.Manager.Opts.RepoConfig {
+		cfg, err := repo.loadRepoConfig()
+		if err != nil {
+			return err
+		}
+		repo.config = cfg
+	}
+
 	auditTimeStart := time.Now()
 
 	r, err := repo.Head()