Skip to content

Address issue where git reports fatal error if codegpt is executed from the hook #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,17 @@
}
}

// git commit automatically
color.Cyan("Git record changes to the repository")
output, err := g.Commit(commitMessage)
if err != nil {
return err
noCommit := os.Getenv("GIT_INDEX_FILE") != ""

Check warning on line 323 in cmd/commit.go

View check run for this annotation

Codecov / codecov/patch

cmd/commit.go#L323

Added line #L323 was not covered by tests

// git commit automatically unless running from within hook
if !noCommit {
color.Cyan("Git record changes to the repository")
output, err := g.Commit(commitMessage)
if err != nil {
return err

Check warning on line 330 in cmd/commit.go

View check run for this annotation

Codecov / codecov/patch

cmd/commit.go#L326-L330

Added lines #L326 - L330 were not covered by tests
}
color.Yellow(output)

Check warning on line 332 in cmd/commit.go

View check run for this annotation

Codecov / codecov/patch

cmd/commit.go#L332

Added line #L332 was not covered by tests
}
color.Yellow(output)
return nil
},
}
1 change: 1 addition & 0 deletions prompt/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var languageMaps = map[string]string{
"ja": "Japanese",
"pt": "Portuguese",
"pt-br": "Brazilian Portuguese",
"ru": "Russian",
}

// GetLanguage returns the language name for the given language code,
Expand Down
Loading