Skip to content

Commit

Permalink
git add . before committing
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk authored and nikandfor committed Nov 24, 2022
1 parent 81a5f78 commit 2a6011c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/commands/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,18 @@ func commitChanges(tmpDir string, commitMessage string) (string, error) {
return "", errors.New("test sentry error")
}

outputBytes, err := exec.Command("git", "-C", tmpDir, "commit", "--allow-empty", "-a", "-m", commitMessage).CombinedOutput()
outputBytes, err := exec.Command("git", "-C", tmpDir, "add", ".").CombinedOutput()
if err != nil {
if _, ok := err.(*exec.ExitError); ok {
fmt.Fprintf(os.Stderr, "failed to add all files: %s", outputBytes)
return "", err
} else {
fmt.Fprintf(os.Stderr, "failed to add all files: %s", err)
return "", err
}
}

outputBytes, err = exec.Command("git", "-C", tmpDir, "commit", "--allow-empty", "-a", "-m", commitMessage).CombinedOutput()
if err != nil {
if _, ok := err.(*exec.ExitError); ok {
fmt.Fprintf(os.Stderr, "failed to create temp commit: %s", outputBytes)
Expand Down

0 comments on commit 2a6011c

Please sign in to comment.