Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

RFC: Gina commit behavior #63

Closed
lambdalisue opened this issue Mar 16, 2017 · 5 comments
Closed

RFC: Gina commit behavior #63

lambdalisue opened this issue Mar 16, 2017 · 5 comments

Comments

@lambdalisue
Copy link
Owner

lambdalisue commented Mar 16, 2017

Currently, the behavior of :Gina commit is

  1. When user close a gina-commit buffer with :wq, the commit message will be committed without prompt
  2. When user close a gina-commit buffer with :q, a prompt will be appeared then
    1. When user hit <Enter> or type Y(es), the commit message will be committed
    2. When user type N(o), the commit message will NOT be committed and the message will be cached so that if user re-open a gina-commit buffer, the cached message is used as a default message

However, as @bimlas mentioned in #44, gina.vim currently get a cached commit message by

  1. Perform an actual commit with cached message
  2. Get a cleaned up commit message
  3. Reset a previous commit
  4. Remove reflogs for above operations

To get a correct cleaned up commit message.

As you notice, this is a bit hackie code and may have some problems. Additionally I noticed that the priority of caching is not really high and I seldom use this feature.
So now I'm thinking about dropping this cache mechanisms to simplify as like #44.
Once I simplify as #44 (or simply merge #44), the behavior would become

  1. When user close a gina-commit buffer with :wq, the commit message will be committed without prompt
  2. When user close a gina-commit buffer with :q, a prompt will be appeared then
    1. When user hit <Enter> or type Y(es), the commit message will be committed
    2. When user type N(o), the commit message will NOT be committed and the message will be discarded and when user re-open a gina-commit buffer, an empty commit message will be used (This is a different behavior)

While this change a behavior, I would like to hear your opinions before I did. This behavior should be settled before the first production release (better to settle before the third beta release).

It related to #59 a bit as well.

@SevereOverfl0w
Copy link

Is there a reason to prompt Yes/No on :q? Particularly if the buffer is not modified?

I'm wondering how common it is to accidentally do :q when you meant :wq

@lambdalisue
Copy link
Owner Author

Because sometime I would NOT like to commit.

@SevereOverfl0w
Copy link

Ah, I understand now. I hadn't considered that you might do: :w followed by :q.

I think the feature I'd like adding is that if the commit is empty when I do :q, then "No" is the default. Similar to fugitive.

@bimlas
Copy link
Collaborator

bimlas commented May 10, 2017

Opened #94 for :q behaviour.

@lambdalisue
Copy link
Owner Author

I haven't face any issue on the current implementation so I decided to not simplify

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants