support config clone timeout, do upgrades

This commit is contained in:
2025-04-23 11:01:52 -04:00
parent d291489247
commit 5f0db640df
7 changed files with 178 additions and 148 deletions

View File

@@ -9,14 +9,12 @@ import (
"gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/projects"
)
const gitCloneTimeoutSecs = 60
// Will either read in the current repo, preparing a report
// on its current state, or will clone the project if it has not
// already been cloned in its path
func (c *Cache) OpenProject(ctx context.Context, project *projects.Project) *git.Repository {
path := c.GetProjectPath(project)
cloneCtx, cncl := context.WithDeadline(ctx, time.Now().Add(gitCloneTimeoutSecs*time.Second))
cloneCtx, cncl := context.WithDeadline(ctx, time.Now().Add(c.config.GetCloneTimeout()))
defer cncl()
var repo *git.Repository