check for notes before deleting them
This commit is contained in:
parent
2574ec733a
commit
1e4b0c0d37
|
@ -13,11 +13,16 @@ import (
|
||||||
// del : true means empty out existing notes, otherwise append
|
// del : true means empty out existing notes, otherwise append
|
||||||
func (repo *Repo) AutogenSave(files []string, refname string, del bool) error {
|
func (repo *Repo) AutogenSave(files []string, refname string, del bool) error {
|
||||||
if del {
|
if del {
|
||||||
|
cmd := []string{"git", "notes", "show", refname}
|
||||||
|
if err := repo.StrictRun(cmd); err != nil {
|
||||||
|
// if there are not any notes, no need to remove them
|
||||||
|
} else {
|
||||||
cmd := []string{"git", "notes", "remove", refname}
|
cmd := []string{"git", "notes", "remove", refname}
|
||||||
if err := repo.StrictRun(cmd); err != nil {
|
if err := repo.StrictRun(cmd); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for _, fname := range files {
|
for _, fname := range files {
|
||||||
autotag := "// `autogen:" + fname + "`"
|
autotag := "// `autogen:" + fname + "`"
|
||||||
cmd := []string{"git", "notes", "append", "-m", autotag, refname}
|
cmd := []string{"git", "notes", "append", "-m", autotag, refname}
|
||||||
|
|
Loading…
Reference in New Issue