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

Reset commit values when auditing uncommitted changes

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

+ 6 - 0
audit/repo.go

@@ -104,6 +104,11 @@ func (repo *Repo) AuditUncommitted() error {
 	if err != nil {
 		return err
 	}
+	c.Hash = plumbing.Hash{}
+	c.Message = "STAGED CHANGES"
+	c.Author.Name = ""
+	c.Author.Email = ""
+	c.Author.When = time.Now()
 
 	prevTree, err := c.Tree()
 	if err != nil {
@@ -164,6 +169,7 @@ func (repo *Repo) AuditUncommitted() error {
 					Commit:   c.Hash.String(),
 					Repo:     repo.Name,
 					Rule:     "file regex matched" + repo.config.FileRegex.String(),
+					Message:  c.Message,
 					Author:   c.Author.Name,
 					Email:    c.Author.Email,
 					Date:     c.Author.When,