Start tasks in a repo with no commits
This commit is contained in:
@@ -119,6 +119,17 @@ func (m *Manager) createTask(ctx context.Context, project api.Project, t api.Tas
|
||||
t.Status = api.TaskStatusActive
|
||||
t.CreatedAt = time.Now().UTC()
|
||||
|
||||
if base == project.DefaultBranch {
|
||||
creator, err := m.store.GetUser(ctx, t.CreatedBy)
|
||||
if err != nil {
|
||||
return api.Task{}, err
|
||||
}
|
||||
err = git.EnsureBranchCommit(ctx, project.RepoPath, base, git.IdentityEnv(creator.GitName, creator.GitEmail))
|
||||
if err != nil {
|
||||
return api.Task{}, err
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
t.BaseRef, err = git.AddWorktree(ctx, project.RepoPath, t.WorktreePath, t.Branch, base)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user