From d7a90a71ab44e85c5abef44ad312e791f1254e71 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 13 Dec 2024 13:52:09 -0600 Subject: [PATCH] optionally pass branch name --- autogen.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/autogen.go b/autogen.go index b157d03..c216716 100644 --- a/autogen.go +++ b/autogen.go @@ -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)) }