Re: [PATCH 3/3] commit: give a hint when a commit message has been abandoned

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 3/3] commit: give a hint when a commit message has been abandoned

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:19

Jeff King [off-list ref] writes:
On Mon, Jul 23, 2012 at 01:49:55PM -0700, Junio C Hamano wrote:
quoted
Jeff King [off-list ref] writes:
quoted
If we launch an editor for the user to create a commit
message, they may put significant work into doing so.
Typically we try to check common mistakes that could cause
the commit to fail early, so that we die before the user
goes to the trouble.

We may still experience some errors afterwards, though; in
this case, the user is given no hint that their commit
message has been saved. Let's tell them where it is.
Liberal use of atexit() for something like this makes me cringe
somewhat.
I don't like it either, but there's not really a better way. The die()
that Ramana triggered in the initial report is deep inside the ident
code. The only other option would be to hook into die_routine, which I
think is even uglier.
Then I would rather not worry about it.  A documentation update is
probably a good first step, though.

Re: [PATCH 3/3] commit: give a hint when a commit message has been abandoned

From: Jeff King <hidden>
Date: 2016-06-15 22:54:19

On Mon, Jul 23, 2012 at 02:00:19PM -0700, Junio C Hamano wrote:
quoted
quoted
Liberal use of atexit() for something like this makes me cringe
somewhat.
I don't like it either, but there's not really a better way. The die()
that Ramana triggered in the initial report is deep inside the ident
code. The only other option would be to hook into die_routine, which I
think is even uglier.
Then I would rather not worry about it.  A documentation update is
probably a good first step, though.
I'm OK with dropping this one; the likely cause is ident problems, and
the previous patch already helped with that (the next likely is probably
commit hooks failing, but that is just a guess).

Here's a documentation patch.

-- >8 --
Subject: [PATCH] commit: document the temporary commit message file

We do not document COMMIT_EDITMSG at all, but users may want
to know about it for two reasons:

  1. They may want to tell their editor to configure itself
     for formatting a commit message.

  2. If a commit is aborted by an error, the user may want
     to recover the commit message they typed.

Let's put a note in git-commit(1).
---
 Documentation/git-commit.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index f400835..87297dc 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -407,6 +407,15 @@ This command can run `commit-msg`, `prepare-commit-msg`, `pre-commit`,
 and `post-commit` hooks.  See linkgit:githooks[5] for more
 information.
 
+FILES
+-----
+
+`$GIT_DIR/COMMIT_EDITMSG`::
+	This file contains the commit message of a commit in progress.
+	If `git-commit` exits due to an error before creating a commit,
+	any commit message that has been provided by the user (e.g., in
+	an editor session) will be available in this file, but will be
+	overwritten by the next invocation of `git-commit`.
 
 SEE ALSO
 --------
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help