Skip to content

Commit 7e0d58f

Browse files
committed
chore: remove unneeded comments and add back in errors
1 parent 7fba3e7 commit 7e0d58f

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

internal/git/git.go

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -363,33 +363,26 @@ func (g *Git) CommitAndPush(openAPIDocVersion, speakeasyVersion, doc string, act
363363

364364
_, githubRepoLocation := g.getRepoMetadata()
365365
owner, repo := g.getOwnerAndRepo(githubRepoLocation)
366+
w, err := g.repo.Worktree()
367+
if err != nil {
368+
return "", fmt.Errorf("error getting working tree: %w", err)
369+
}
366370

367371
branch, err := g.GetCurrentBranch()
368372
if err != nil {
369373
return "", fmt.Errorf("error getting current branch: %w", err)
370374
}
371375

372-
// Get working tree locally
373-
// localWorkingTree, err := g.repo.Worktree()
374-
// if err != nil {
375-
// return "", fmt.Errorf("error getting worktree: %w", err)
376-
// }
377-
378376
// Add local files and changes
379377
if err := g.Add("."); err != nil {
380378
return "", fmt.Errorf("error adding changes: %w", err)
381379
}
382-
w, _ := g.repo.Worktree()
383-
status, err := w.Status()
384380

385-
fmt.Println("status", status)
386-
fmt.Println("Attempting to push changes")
387-
// if err := g.repo.Push(&git.PushOptions{
388-
// Auth: getGithubAuth(g.accessToken),
389-
// }); err != nil {
390-
// fmt.Errorf("error in CommitAndPush code: %w", err, branch)
391-
// return "", pushErr(err)
392-
// }
381+
// Get status of changed files
382+
status, err := w.Status()
383+
if err != nil {
384+
return "", fmt.Errorf("error getting status for branch: %w", err)
385+
}
393386

394387
ref, _, err := g.client.Git.GetRef(context.Background(), owner, repo, "refs/heads/"+branch)
395388
if err != nil {

0 commit comments

Comments
 (0)