fixed creating prs and returning early
This commit is contained in:
@@ -10,12 +10,12 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func Start(ctx context.Context, logger *zap.Logger) (*serverdeps.ServerDeps, error) {
|
||||
func Start(ctx context.Context, logger *zap.Logger) (*serverdeps.ServerDeps, curre.CleanupFunc, error) {
|
||||
deps := serverdeps.NewServerDeps(logger)
|
||||
|
||||
readyChan := make(chan curre.ComponentsAreReady, 1)
|
||||
|
||||
err := curre.NewManager().
|
||||
cleanupFunc, err := curre.NewManager().
|
||||
Register(
|
||||
server.NewStorageServer(logger.With(zap.Namespace("storage")), deps),
|
||||
).
|
||||
@@ -26,5 +26,5 @@ func Start(ctx context.Context, logger *zap.Logger) (*serverdeps.ServerDeps, err
|
||||
|
||||
<-readyChan
|
||||
|
||||
return deps, err
|
||||
return deps, cleanupFunc, err
|
||||
}
|
||||
|
@@ -189,8 +189,9 @@ func (pr *ProcessRepos) commit(ctx context.Context, area *storage.Area, repo *pr
|
||||
}
|
||||
|
||||
if status.IsClean() {
|
||||
// TODO: check for pr
|
||||
pr.logger.Info("Returning early, as no modifications are detected")
|
||||
return nil
|
||||
//return nil
|
||||
}
|
||||
|
||||
err = pr.git.Commit(ctx, repo)
|
||||
|
@@ -84,7 +84,7 @@ func (g *GoGit) GetOriginHEADForRepo(ctx context.Context, gitRepo *GoGitRepo) (s
|
||||
headRef := ""
|
||||
for _, ref := range refs {
|
||||
//g.logger.Debug(ref.String())
|
||||
if !ref.Name().IsBranch() {
|
||||
if ref.Target().IsBranch() {
|
||||
headRef = ref.Target().Short()
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ func (g *GoGit) Clone(ctx context.Context, storageArea *storage.Area, repoUrl st
|
||||
URL: repoUrl,
|
||||
Auth: auth,
|
||||
RemoteName: "origin",
|
||||
ReferenceName: "refs/heads/main",
|
||||
ReferenceName: "",
|
||||
SingleBranch: false,
|
||||
NoCheckout: false,
|
||||
Depth: 1,
|
||||
@@ -227,12 +227,12 @@ func (g *GoGit) CreateBranch(ctx context.Context, gitRepo *GoGitRepo) error {
|
||||
return fmt.Errorf("could not checkout branch: %w", err)
|
||||
}
|
||||
|
||||
remoteRef := plumbing.NewRemoteReferenceName("origin", "octopush-apply")
|
||||
ref := plumbing.NewSymbolicReference(refSpec, remoteRef)
|
||||
err = gitRepo.repo.Storer.SetReference(ref)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not set reference: %w", err)
|
||||
}
|
||||
//remoteRef := plumbing.NewRemoteReferenceName("origin", "octopush-apply")
|
||||
//ref := plumbing.NewSymbolicReference(refSpec, remoteRef)
|
||||
//err = gitRepo.repo.Storer.SetReference(ref)
|
||||
//if err != nil {
|
||||
// return fmt.Errorf("could not set reference: %w", err)
|
||||
//}
|
||||
|
||||
auth, err := g.GetAuth()
|
||||
if err != nil {
|
||||
@@ -241,7 +241,7 @@ func (g *GoGit) CreateBranch(ctx context.Context, gitRepo *GoGitRepo) error {
|
||||
|
||||
err = worktree.PullContext(ctx, &git.PullOptions{
|
||||
RemoteName: "origin",
|
||||
ReferenceName: "refs/heads/main",
|
||||
ReferenceName: "",
|
||||
SingleBranch: false,
|
||||
Depth: 1,
|
||||
Auth: auth,
|
||||
|
Reference in New Issue
Block a user