@@ -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