fixed creating prs and returning early
This commit is contained in:
@@ -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