-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
q
should not abort the commit if it contains a written commit message.
#552
Comments
Been looking into this. Looks like the commit logic is handled in a Anyone know of a way to cancel the autocmd's event during its execution? That would probably be the easiest way to manage this, but I'm not sure if it's possible... A different approach may require reworking the logic outside an autocmd, which could be a rather major task. By the way, you can also use |
This is slightly tangential, but for the longest time I've had an autocmd set up thats essentially:
So, you leave insert mode, and it write the buffer to disk. The reasoning behind this is pretty simple: if I made changes, I probably wanted to. And writes take a negligible amount of time. I'm bringing this up because my experience is exactly what we're describing as the ideal - dont let a user accidentally close the buffer with an unwritten commit message, discarding the commit.. because it's almost never in an unwritten state. It would be trivial to add such an autocmd thats buffer-local, and could even gate it behind a config flag. |
I am trying to use I think I need a firmware update as well. Good point that aborting the commit should not discard the message entirely, hadn't thought about it. What I usually do when I remember I forgot to stage a file when writing the commit, I commit anyway and then amend instead. There are definitely some good questions and considerations regarding the workflow, and I am open to all suggestions. |
This is an interesting idea. Do you need to still need to use Alternatively, it would also be pretty easy to modify the existing autocmd to do a write when the buffer is closing (after a confirmation, of course). But neither of these ideas solve the problem of wanting to keep the buffer open after accidentally
I get that. I got used to |
I may be wrong, but doing
I.e; git has no way to tell from the invoked editor of what to do besides the contents of the |
I think this is wrong. You can do a |
Yes, sorry. What I meant was that if the buffer wasn't cleared after the editor has exited. If you were to save the message to disk you would have to change the filename as well, or else it would fire off a commit when the editor is closed unless the buffer is cleared (which would defeat the purpose of saving it to the disk). |
Ah, I see what you mean. Yeah, I don't think we would have a way of telling if the commit should be discarded or not if we're auto-writing during editing. We could add a special keybind to the commit buffer to let neogit know to clear the buffer. But that would be un-git-like, and indirectly change the meaning of |
Yes. I think that the problem is eerily similar to Maybe something similar where the commit buffer or another in progress message is saved under e.g |
We should probably handle this like Magit does: #492 could be added, for example |
I think in a perfect world, |
I don't think thats possible - putting aside neogit for a second, when you're using git on the command line and you make a commit, it will open up Neogit basically hijacks this workflow, and when the commit editor view opens, you're actually communicating via But, I haven't really looked into this system yet, so who knows :) |
I've encountered this multiple times because I try
:wq
to save and quit to commit, but accidentally just hitq
which makes me lose the commit message.Having a prompt if there are unsaved changes would be preferred
The text was updated successfully, but these errors were encountered: