check for notes before deleting them
This commit is contained in:
parent
2574ec733a
commit
1e4b0c0d37
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue