Skip to content

Commit 185f330

Browse files
committed
resolve commit failure to fallback to git client when the repo is a newly initialised repo
1 parent aee79a1 commit 185f330

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

graph/schema.resolvers.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,13 @@ func (r *mutationResolver) CommitChanges(ctx context.Context, repoID string, com
142142
go git.Repo(repoID, repoChan)
143143
repo := <-repoChan
144144
if head, _ := repo.GitRepo.Head(); repo.GitRepo == nil || head == nil {
145-
return "COMMIT_FAILED", nil
145+
w, _ := repo.GitRepo.Worktree()
146+
if w != nil {
147+
return git.CommitChanges(repo.GitRepo, commitMessage), nil
148+
} else {
149+
return "COMMIT_FAILED", nil
150+
}
146151
}
147-
148152
return git.CommitChanges(repo.GitRepo, commitMessage), nil
149153
}
150154

0 commit comments

Comments
 (0)