git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Sajine <euguess@gmail.com>
To: Wincent Colaiuta <win@wincent.com>
Cc: Avery Pennarun <apenwarr@gmail.com>,
	Jacob Helwig <jacob.helwig@gmail.com>,
	git@vger.kernel.org
Subject: Re: [BUG] - "git commit --amend" commits, when exiting the editor  with no changes written
Date: Tue, 2 Feb 2010 17:31:08 -0500	[thread overview]
Message-ID: <76c5b8581002021431o2b5073a0s42b273b6d61893db@mail.gmail.com> (raw)
In-Reply-To: <77153A83-158D-4D36-A622-7AA3947C7D52@wincent.com>

>
> Why should Git care about how you exited from your EDITOR? All it should
> care about is the contents of the commit message, and the exit code of the
> editor.

It doesn't matter which editor is used. The only thing that matters is
that you saving or not saving on exit from editor. If not saving -
abort the action.

>
>> For example IF there is a variable somewhere where message is stored:
>> For new commit message it is NULL and when commit is ready it is set
>> up to "message". We check If it is not empty and not NULL (:wq
>> executed),  then we can commit.
>> For "prepopulated" messages this variable can be is set to "message"
>> from the beginning, so it doesn't matter if you're writing changes or
>> not the check will always be true, so we can commit.
>
> I don't understand what change you're asking for, as things already work as
> you've just described (the "variable" is the file, .git/COMMIT_EDITMSG).

So, i was right in my assumption about how it is implemented - good;)

>
>> If the implementation would be like this, then I would propose to
>> clean up this variable after the prepopulated message is populated, so
>> it won't use it blindly, but only after you're overwriting the message
>> (even if the message is not changed).
>
> Here is where you've lost me. Not sure what you mean here, nor how you're
> going to maintain the existing behavior for all of the people who have grown
> used to it over a long, long period of time.

Let me explain it like this (sorry for syntax):

new commit:

COMMIT_EDITMSG = NULL;
$ git commit

in background:
$EDITOR .git/COMMIT_EDITMSG

If saved/written
COMMIT_EDITMSG=message

if (COMMIT_EDITMSG != NULL &&  !COMMIT_EDITMSG.equalsIgnoreCase("")  )  {
commit();
} else abort();

====================
amend or rebase:
COMMIT_EDITMSG = "message from commit or rebase sequence";
$ git commit --amend

in background:
$EDITOR .git/COMMIT_EDITMSG

COMMIT_EDITMSG = NULL    <======== this i think is missing. We have to
clean it after it is populated in the editor.

If written back by save:
COMMIT_EDITMSG="message from commit or rebase sequence" (it was not
changed, but saved/written)

If not saved, the check below will abort the action

if (COMMIT_EDITMSG != NULL &&  !COMMIT_EDITMSG.equalsIgnoreCase("")  )  {
commit();
} else abort();


Is that a better explanation?

So, the only change from user perspective will be that you will have
always save/write your changes/rebase sequences (even if you don't
change the message) for the program to proceed with commit
amend/rebase or whatever the same way as for the simple commit.

Thanks,
Eugene

  reply	other threads:[~2010-02-02 22:31 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 20:07 [BUG] - "git commit --amend" commits, when exiting the editor with no changes written Eugene Sajine
2010-02-02 20:14 ` Jacob Helwig
2010-02-02 20:27   ` Avery Pennarun
2010-02-02 20:47     ` Eugene Sajine
2010-02-02 20:58       ` Wincent Colaiuta
2010-02-02 21:56         ` Eugene Sajine
2010-02-02 22:03           ` Erik Faye-Lund
2010-02-02 22:06           ` Wincent Colaiuta
2010-02-02 22:31             ` Eugene Sajine [this message]
2010-02-02 22:35               ` Avery Pennarun
2010-02-02 23:02                 ` Eugene Sajine
2010-02-02 23:15                   ` Johannes Schindelin
2010-02-02 23:27                     ` Eugene Sajine
2010-02-02 23:40                   ` Avery Pennarun
2010-02-03  6:15                     ` Larry D'Anna
2010-02-03  9:31                       ` Jeff King
2010-02-03 10:15                         ` Jeff King
2010-02-03 18:19                         ` Avery Pennarun
2010-02-02 23:00               ` Johannes Schindelin
2010-02-02 23:34                 ` Eugene Sajine
2010-02-02 23:40                   ` Erik Faye-Lund
2010-02-02 23:48                     ` Eugene Sajine
2010-02-03  0:16                       ` Erik Faye-Lund
2010-02-03  0:55                         ` Eugene Sajine
2010-02-03  1:59                           ` SZEDER Gábor
2010-02-03  7:34                             ` Matthieu Moy
2010-02-03  9:08                               ` aborting rebase -i right at the start, was " Johannes Schindelin
2010-02-03  9:41                                 ` SZEDER Gábor
2010-02-03 16:02                                   ` Eugene Sajine
2010-02-03  7:31                       ` Matthieu Moy
2010-02-03 15:45                         ` Eugene Sajine
2010-02-03 17:51                           ` Jonathan Nieder
2010-02-03 17:53                             ` Jonathan Nieder
2010-02-03 18:21                           ` Wincent Colaiuta
2010-02-03 18:49                             ` Eugene Sajine
2010-02-03 18:57                               ` Avery Pennarun
2010-02-03 19:27                                 ` Eugene Sajine
2010-02-03 19:54                                   ` Avery Pennarun
2010-02-03 18:47                           ` Matthieu Moy
2010-02-02 23:58                   ` Johannes Schindelin
2010-02-03  0:09                     ` Eugene Sajine
2010-02-03  9:04                       ` Johannes Schindelin
2010-02-03  9:46                       ` Paolo Bonzini
2010-02-02 23:44                 ` Junio C Hamano
2010-02-02 21:18       ` Avery Pennarun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76c5b8581002021431o2b5073a0s42b273b6d61893db@mail.gmail.com \
    --to=euguess@gmail.com \
    --cc=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.helwig@gmail.com \
    --cc=win@wincent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).