git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] git-commit: add a commit.verbose config variable
@ 2016-02-26  2:57 Pranit Bauva
  2016-02-25 21:27 ` Matthieu Moy
  2016-02-26  3:00 ` Eric Sunshine
  0 siblings, 2 replies; 7+ messages in thread
From: Pranit Bauva @ 2016-02-26  2:57 UTC (permalink / raw)
  To: Git Mailing List, Jeff King, Matthieu Moy, Johannes Schindelin,
	Stefan Beller, Christian Couder, Lars Schneider

>From c273a02fc9cab9305cedf6e37422e257a1cc3b1e Mon Sep 17 00:00:00 2001
From: Pranit Bauva <pranit.bauva@zoho.com>
Date: Fri, 26 Feb 2016 07:14:18 +0530
Subject: [PATCH/RFC] git-commit: add a commit.verbose config variable

Since many people always run the command with this option, and would
prefer not to use the argument again and again but instead specify it in
some config file.

The variable `verbose` is changed instead of `s.verbose` as the method
run_status() updates the `s.verbose` with the value of `verbose`. So in
this way the change is reflected in both of them.

Signed-off-by: Pranit Bauva <pranit.bauva@zoho.com>
---

Notes:
    This is a patch for the microproject of GSOC 2016. I have done the change
    under careful consideration of where to place the line. I have to yet write
    the tests for this. I have explored the config API and I am currently going
    through the tests part. I have run the test locally by manually checking.
    I currently learning about the test suite. I will update this patch
    with some tests in some time.

 Documentation/config.txt     | 5 +++++
 Documentation/git-commit.txt | 3 ++-
 builtin/commit.c             | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 01cca0a..f7e9c09 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1110,6 +1110,11 @@ commit.template::
 	"`~/`" is expanded to the value of `$HOME` and "`~user/`" to the
 	specified user's home directory.
 
+commit.verbose::
+	A boolean to specify whether to always include the verbose option
+	with git-config.
+	See linkgit:git-commit[1]
+
 credential.helper::
 	Specify an external helper to be called when a username or
 	password credential is needed; the helper may consult external
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 9ec6b3c..2a72437 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -290,7 +290,8 @@ configuration variable documented in linkgit:git-config[1].
 	what changes the commit has.
 	Note that this diff output doesn't have its
 	lines prefixed with '#'. This diff will not be a part
-	of the commit message.
+	of the commit message. If this option is used always, it can
+	be set in the git-config with the boolean variable `commit.verbose`.
 +
 If specified twice, show in addition the unified diff between
 what would be committed and the worktree files, i.e. the unstaged
diff --git a/builtin/commit.c b/builtin/commit.c
index b3bd2d4..68080fe 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1644,6 +1644,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	status_format = STATUS_FORMAT_NONE; /* Ignore status.short */
 	s.colopts = 0;
 
+	git_config_get_bool("commit.verbose", &verbose);
+
 	if (get_sha1("HEAD", sha1))
 		current_head = NULL;
 	else {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-26 17:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-26  2:57 [PATCH/RFC] git-commit: add a commit.verbose config variable Pranit Bauva
2016-02-25 21:27 ` Matthieu Moy
2016-02-25 21:58   ` Stefan Beller
2016-02-26  3:00 ` Eric Sunshine
2016-02-26 13:26   ` Pranit Bauva
2016-02-26 16:56     ` Junio C Hamano
2016-02-26 17:32       ` Matthieu Moy

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).