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
Improve feedback flow #85
Comments
Yes, I agree that it is very annoying to loose a (long) carefully crafted commit message simply because it failed one-or-two syntax checks. So it needs a way to persist to next commit. Well, a wild idea would be "autocorrection" of the more obvious style errors. For example, remove full stops at the end of the subject line and. Or even if some style check failed with an error, then a subsequent template might attempt to correct it for the user (like provide a default scope of the change or attempt to insert a missing newline between subject and body) But those are all wild. The important thing is to definitely keep the commit message instead of throwing it away. That functionality goes hand-in-hand with a issue 25 message template. |
Reusing the previous commit message as a template for the next one, but only if the last attempt failed, sounds interesting. Could still combine that with an actual template, when there is no previous failed attempt. |
My current thinking is to write a separate That was for a repo-local install. The global install behaves differently: it just looks at commit history. So there will be no templates at all, they do not make sense. |
That sounds good! |
@all3fox would still be great to address this. Will you have a chance to implement it? |
@jzaefferer I will see what I can do on Wednesday 7/12/16 |
@all3fox would you still be interested in working on this? |
Sorry to keep feeding you promises. I tried to hack it yesterday-today but did not make much progress. It is also a month of exams for me now, so I will not be doing it in January anymore, I will get back to it in February. Here is an actual question for you: in order to reuse the faulty commit message, it has to be saved somewhere. So, the
|
Could we write a COMMIT_EDITMSG_OLD before exiting with an error code, and look for that the next time? |
If you spend time making a commit message that then fails style check, you should not have to start over from scratch. Instead, you should be able to reuse the old message and fix its style errors. By default the old message is stored in .git/COMMIT_EDITMSG_OLD Refs #85
If the commit message that failed style check was created more than 300 seconds ago (5 mins), it will *not* be reused and will be removed from cache file. Default cache file is .git/COMMIT_EDITMSG_OLD Move option checking code from validation.js to `getOption` in index.js Reuse `getOption` in both index.js and prepare-commit-msg-hook.js Refs #85
Fixed by 5fe2074, released as 2.7.8. |
Currently the commit-msg hook is rather bad at providing feedback. It aborts the commit, dumps the message on the terminal and then leaves it to the user to start over. Something a little more interactive would be nice, like keeping the previous message when attempting to commit again.
Hoping @all3fox might have some ideas what we could do here.
The text was updated successfully, but these errors were encountered: