diff --git a/autogen.go b/autogen.go index c216716..8d78780 100644 --- a/autogen.go +++ b/autogen.go @@ -13,9 +13,14 @@ import ( // del : true means empty out existing notes, otherwise append func (repo *Repo) AutogenSave(files []string, refname string, del bool) error { if del { - cmd := []string{"git", "notes", "remove", refname} + cmd := []string{"git", "notes", "show", refname} if err := repo.StrictRun(cmd); err != nil { - return err + // if there are not any notes, no need to remove them + } else { + cmd := []string{"git", "notes", "remove", refname} + if err := repo.StrictRun(cmd); err != nil { + return err + } } } for _, fname := range files {