Skip to content

Commit

Permalink
fetch updates on a bare repo (#266)
Browse files Browse the repository at this point in the history
* fetch updates on a bare repo

* move print and fetch outside of the if clause
  • Loading branch information
cooperspencer authored Aug 30, 2024
1 parent fe1afa3 commit d346b1d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -358,20 +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
}
}
// 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
}
}
}
Expand Down

0 comments on commit d346b1d

Please sign in to comment.