Skip to content

Commit

Permalink
fix fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperspencer committed Feb 17, 2024
1 parent 1b7e03f commit a206e4f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,19 @@ func updateRepository(repoPath string, auth transport.AuthMethod, dry bool, l ty
err = r.Fetch(&git.FetchOptions{Auth: auth, RemoteName: "origin", RefSpecs: []config.RefSpec{"+refs/*:refs/*"}})
if !l.Bare {
w, err := r.Worktree()
if err != nil {
if err == git.NoErrAlreadyUpToDate {
err = nil
} else {
return err
}

sub.Info().
Msgf("pulling %s", types.Green(repoPath))

err = w.Pull(&git.PullOptions{Auth: auth, RemoteName: "origin", SingleBranch: false})
if err != nil {
if err == git.NoErrAlreadyUpToDate {
err = nil
} else {
return err
}
}
Expand Down Expand Up @@ -412,6 +416,9 @@ func cloneRepository(repo types.Repo, auth transport.AuthMethod, dry bool, l typ
Auth: auth,
Force: true,
})
if err == git.NoErrAlreadyUpToDate {
err = nil
}
}

return err
Expand Down

0 comments on commit a206e4f

Please sign in to comment.