Skip pushing merges when the repo has no remote
This commit is contained in:
@@ -218,8 +218,11 @@ func (m *Manager) deliverMerge(ctx context.Context, sess api.AgentSession, task
|
||||
}
|
||||
|
||||
func pushLanded(ctx context.Context, project api.Project, commit string) (bool, error) {
|
||||
target := git.Remote + "/" + project.DefaultBranch
|
||||
err := git.Fetch(ctx, project.RepoPath)
|
||||
target, err := git.Upstream(ctx, project.RepoPath, project.DefaultBranch)
|
||||
if err != nil {
|
||||
return false, &unfinishedMergeError{fmt.Errorf("checking whether %s reached %s failed: %w", commit, project.DefaultBranch, err)}
|
||||
}
|
||||
err = git.Fetch(ctx, project.RepoPath)
|
||||
if err != nil {
|
||||
return false, &unfinishedMergeError{fmt.Errorf("checking whether %s reached %s failed: %w", commit, target, err)}
|
||||
}
|
||||
@@ -341,7 +344,11 @@ func (m *Manager) landMerge(ctx context.Context, f store.FinalizingMerge) error
|
||||
}
|
||||
return m.closeUnchanged(ctx, task, project, f.By)
|
||||
}
|
||||
err = m.store.SetFinalizingCommit(ctx, task.Id, commit, notes, git.Remote+"/"+project.DefaultBranch)
|
||||
pushed, err := git.Upstream(ctx, project.RepoPath, project.DefaultBranch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = m.store.SetFinalizingCommit(ctx, task.Id, commit, notes, pushed)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -376,8 +383,11 @@ func (m *Manager) closeUnchanged(ctx context.Context, task api.Task, project api
|
||||
}
|
||||
|
||||
func (m *Manager) closePushed(ctx context.Context, task api.Task, project api.Project, commit, notes, login string) error {
|
||||
pushed := git.Remote + "/" + project.DefaultBranch
|
||||
err := advanceMainCheckout(project, commit, notes)
|
||||
pushed, err := git.Upstream(ctx, project.RepoPath, project.DefaultBranch)
|
||||
if err != nil {
|
||||
return &unfinishedMergeError{err}
|
||||
}
|
||||
err = advanceMainCheckout(project, commit, notes, pushed)
|
||||
if err != nil {
|
||||
return &unfinishedMergeError{err}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user