appleboy / CodeGPT

A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4o, gpt-4-turbo, gpt-3.5-turbo model) and automatically installs a git prepare-commit-msg hook.
MIT License
1.19k stars 102 forks source link

hook not work #191

Open Chindada opened 1 month ago

Chindada commented 1 month ago

version: v0.14.2

To Reproduce

  1. git commit
  2. enter commit message edit vi
  3. enter :q

Describe the bug It will commit during the vi editor is showing, when i leaving vi, error occurs.

git commit
golangci-lint........................................(no files to check)Skipped
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check that scripts with shebangs are executable..........................Passed
detect private key.......................................................Passed
Summarize the commit message use gpt-4o model
We are trying to summarize a git diff
PromptTokens: 589, CompletionTokens: 15, TotalTokens: 604
We are trying to summarize a title for pull request
PromptTokens: 196, CompletionTokens: 5, TotalTokens: 201
We are trying to get conventional commit prefix (Tools)
PromptTokens: 398, CompletionTokens: 5, TotalTokens: 403
================Commit Summary====================

build: improve system performance and stability

- Change Docker run command to use detached mode (`-d` flag)

==================================================
Write the commit message to .git/COMMIT_EDITMSG file
Git record changes to the repository
[develop dff0b2a] build: improve system performance and stability
 1 file changed, 1 insertion(+), 1 deletion(-)
fatal: cannot lock ref 'HEAD': is at dff0b2a88ce8089b4b24a61b1a4af5a31c8551f2 but expected b8e772c02c69640938447f6b2f8474ddb77fafcc
build: improve system performance and stability

- Change Docker run command to use detached mode (`-d` flag)

Signed-off-by: Tim Hsu@M2MAX-20230327 <maochindada@gmail.com>
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
~                                                                                                                                             
"~/dev_projects/iom/mojave/.git/COMMIT_EDITMSG" 5L, 173B
appleboy commented 1 month ago

I will take it.

alexander-turner commented 2 weeks ago

I'm having this issue too. Currently I:

  1. Can only accept the commit message (no backing out with q!), and
  2. Can't modify the commit message due to an error like
    fatal: cannot lock ref 'HEAD': is at 6555dec73f8f44a0230f1acb3dce034d3572d4fa but expected 4961b3359a9643d1321437d5b124d1607436df9c