summaryrefslogtreecommitdiff
path: root/autogen.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-13 17:31:40 -0600
committerJeff Carr <[email protected]>2024-12-13 17:31:40 -0600
commit1e4b0c0d3742bc953d5b21e3d901e94d1268c72f (patch)
tree86c8de8a46ab26fa0052b178889208b72d983d6b /autogen.go
parent2574ec733a812a747b3e4075f8affc862453034f (diff)
check for notes before deleting themv0.0.28
Diffstat (limited to 'autogen.go')
-rw-r--r--autogen.go9
1 files changed, 7 insertions, 2 deletions
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 {