Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-15

Re: [PATCH 0/3] "commit --template" fixes

From: Adam Monsen <hidden>
Date: 2016-06-15 22:53:26
Subsystem: documentation, the rest · Maintainers: Jonathan Corbet, Linus Torvalds

Possibly related (same subject, not in this thread)

On 03/30/2012 12:45 PM, Junio C Hamano wrote:
When the user exited editor without editing the commit log template 
given by "git commit -t <template>", the commit was aborted (correct)
with an error message that said "due to empty commit message"
(incorrect).  The goal of this series is to fix this, which is the
third patch.
This is awesome. thanks!

I really like the new error message specific to the situation when
the user does not edit the template (as we discussed).

Your patches apply cleanly to maint b8939b2b3abaa.

I tested the patches and they work as expected. When I use
`git commit --template FILE` but do not edit the message in my editor,
I get

	Aborting commit; you did not edit the message.

Nice.

Only thing I'd add is a change to the git-commit(1) manpage.

* I prefer pragmatically explaining what will happen when the user
  uses --template but does not edit the message because it is more
  direct and terse (than "filling in a form").
* The below applies cleanly to maint as of today.
* I don't know the kosher procedure to add this commit to your patch
  series for further review, so hopefully this works.
* I'm not sure if the "Helped-by:" lines are kosher, I'm happy to
  remove them if not.

From 91a62baa1fe89032e7a3598e5d39241f3eb8f84b Mon Sep 17 00:00:00 2001
From: Adam Monsen <redacted>
Date: Sat, 31 Mar 2012 12:09:29 -0700
Subject: [PATCH] git-commit.txt: clarify -t requires editing message

Make it clear that, when using commit --template, the message *must* be
changed or the commit will be aborted.

Helped-by: Junio C Hamano [off-list ref]
Helped-by: Ivan Heffner [off-list ref]
Signed-off-by: Adam Monsen <redacted>
---
I wrapped the text at 77 characters because that was the longest
line in the file (according to wc -L).

I used ":set noet nosta ts=8 sw=8 tw=77" in Vim.

 Documentation/git-commit.txt |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 5cc84a1..f584a62 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -132,11 +132,11 @@ OPTIONS
 
 -t <file>::
 --template=<file>::
-	Use the contents of the given file as the initial version
-	of the commit message. The editor is invoked and you can
-	make subsequent changes. If a message is specified using
-	the `-m` or `-F` options, this option has no effect. This
-	overrides the `commit.template` configuration variable.
+	Use the contents of the given file as the initial version of the
+	commit message. The editor is invoked so you can make subsequent
+	changes. If you make no changes, the commit is aborted. If a message
+	is specified using the `-m` or `-F` options, this option has no
+	effect. This overrides the `commit.template` configuration variable.
 
 -s::
 --signoff::
-- 
1.7.5.4

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help