Closed chiphogg closed 2 years ago
2. Make some changes, and re-enter normal mode. 3. Press
-
. This takes you to the.git
directory, with the cursor on theCOMMIT_EDITMSG
file. 4. Hit Enter to return to the file... where did the changes go?
At this point, fugitive should have performed git commit
. Is that not the case? If you didn't :write
in step 2, Dirvish should report "E37: No write since last change"
.
Even if the commit message is saved & written, it's neverthless annoying when I hit -
without actually wanting to trigger a commit. So I'm thinking about guarding against this.
This works perfectly for me. Thanks!
I am using this with the widely used fugitive plugin.
To reproduce:
:Git
, stage some files, and presscc
to commit.)-
. This takes you to the.git
directory, with the cursor on theCOMMIT_EDITMSG
file.While writing this issue description, I figured out that what's happening is that upon leaving the
COMMIT_EDITMSG
window, a commit is attempted (presumably by the fugitive plugin). Since we haven't saved our content, it thinks we're committing with an empty message, and thus aborts the commit. This clobbers all of the content in the window. If we hit Enter to return to the file, there is no way that I could see to restore the old content (e.g., undo and redo have no effect).The most natural solution I can think of is to disable the
-
mapping insideCOMMIT_EDITMSG
. While it's easy for me to do this locally, I think a global solution is worthwhile because there is a significant risk to lose work for people who use both of these commonly used plugins... and the risk is worse for people who take the time to write good commit messages.I'm not sure if the issue should be filed here, or with fugitive, but I figured this is a good place to start the conversation! :slightly_smiling_face: