From 36fd205da8d0ff4d42d631101ab3ac66f45d9947 Mon Sep 17 00:00:00 2001 From: Andreas Wachter Date: Fri, 30 Aug 2024 12:29:21 +0200 Subject: [PATCH] move print and fetch outside of the if clause --- local/local.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/local/local.go b/local/local.go index 9122a4f..1dac31a 100644 --- a/local/local.go +++ b/local/local.go @@ -349,6 +349,8 @@ func updateRepository(reponame string, auth transport.AuthMethod, dry bool, l ty return err } } + sub.Info(). + Msgf("pulling %s", types.Green(reponame)) if !l.Bare { w, err := r.Worktree() if err != nil { @@ -358,24 +360,17 @@ func updateRepository(reponame string, auth transport.AuthMethod, dry bool, l ty return err } } - sub.Info(). - Msgf("pulling %s", types.Green(reponame)) - err = w.Pull(&git.PullOptions{Auth: auth, RemoteName: "origin", SingleBranch: false}) if err == git.NoErrAlreadyUpToDate { err = nil } else { return err } - // if everything was ok, fetch everything - err = r.Fetch(&git.FetchOptions{Auth: auth, RemoteName: "origin", RefSpecs: []config.RefSpec{"+refs/*:refs/*"}}) - if err != nil { - return err - } - } else { - sub.Info(). - Msgf("pulling %s", types.Green(reponame)) - err = r.Fetch(&git.FetchOptions{Auth: auth, RemoteName: "origin", RefSpecs: []config.RefSpec{"+refs/*:refs/*"}}) + } + // if everything was ok, fetch everything + err = r.Fetch(&git.FetchOptions{Auth: auth, RemoteName: "origin", RefSpecs: []config.RefSpec{"+refs/*:refs/*"}}) + if err != nil { + return err } } }