rhysd / committia.vim

A Vim plugin for more pleasant editing on commit messages
MIT License
731 stars 30 forks source link

Does not work with amend #55

Open sbeyer opened 3 years ago

sbeyer commented 3 years ago

Committia is not triggered for git commit --amend... I also did not find a config option for that. (Moreover, I think no config option would be necessary...)

bew commented 3 years ago

Hmm it does work for me However it only shows the diff of new changes (the changes amended to the commit), not all the changes in the commit + the new changes. (sometimes I like it, sometimes I want to see all...)

sbeyer commented 3 years ago

I tested it again, and it also works for me. The case when I thought it didn't work was when I used git commit --amend to only fix a typo in the commit message, that is, there were no changes so the diff would be empty. I guess the bug I reported is a feature, but I was confused by it. Still, now that I know, it's fine. We can probably close this issue.

mmrwoods commented 2 years ago

FWIW, I also find this very confusing. When I commit, I normally use the --verbose option so I see the changes I am committing while writing the commit message. The same applies when I amend a commit. Whether I am adding a new change to a commit or just fixing a typo, I still want to see all of the changes this commit will introduce as I amend the message.

Even when using git commit --amend --verbose with commitia, it strips out the original changes and shows only new additions, making it unusable for me, which is a shame, because it is otherwise a great plugin. I'll probably have a look at the plugin code to see how easy it would be to add an option to allow this feature to be switched off, but in maybe @rhysd can suggest a workaround too?

mmrwoods commented 2 years ago

FYI, had a look at the plugin code to see how easy it would be to show the full diff when amending commits...

It should be simple to extract the diff from COMMIT_EDITMSG if available, falling back to running git diff if needed, but this would also require extracting the status from COMMIT_EDITMSG rather than running git status, otherwise the status and diff windows could be mismatched. This seems messy, and potentially brittle, so not sure it's worth the effort.