optionally pass branch name

This commit is contained in:
Jeff Carr 2024-12-13 13:52:09 -06:00
parent adef980837
commit d7a90a71ab
1 changed files with 9 additions and 2 deletions

View File

@ -39,8 +39,15 @@ func (repo *Repo) AutogenSave(files []string, refname string, del bool) error {
}
// restores files from git metadata (notes)
func (repo *Repo) AutogenRestore() error {
result := repo.Run([]string{"git", "notes", "show"})
func (repo *Repo) AutogenRestore(refname string) error {
var cmd []string
if refname == "" {
cmd = []string{"git", "notes", "show"}
} else {
cmd = []string{"git", "notes", "show", refname}
}
result := repo.Run(cmd)
if result.Exit != 0 {
return errors.New(fmt.Sprint("git notes show returned ", result.Exit))
}