aboutsummaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorJames P. Howard, II <jh@jameshoward.us>2009-12-07 17:45:27 -0500
committerJunio C Hamano <gitster@pobox.com>2010-01-13 00:01:53 -0800
commitbed575e4002cfa1dfa7d87b9db38e69c6f600e2e (patch)
treecae28f4c7eda5394f087b4974487ca25da69248e /builtin-commit.c
parentb809d9cd0787e68f442c6795ec76580bb37d1a00 (diff)
downloadgit-bed575e4002cfa1dfa7d87b9db38e69c6f600e2e.tar.gz
git-bed575e4002cfa1dfa7d87b9db38e69c6f600e2e.tar.xz
commit: support commit.status, --status, and --no-status
A new configuration variable commit.status, and new command line options --status, and --no-status control whether or not the git status information is included in the commit message template when using an editor to prepare the commit message. It does not affect the effects of a user's commit.template settings. Signed-off-by: James P. Howard, II <jh@jameshoward.us> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index e93a647c5..095c1869e 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -67,7 +67,7 @@ static enum {
} cleanup_mode;
static char *cleanup_arg;
-static int use_editor = 1, initial_commit, in_merge;
+static int use_editor = 1, initial_commit, in_merge, include_status = 1;
static const char *only_include_assumed;
static struct strbuf message;
@@ -97,6 +97,7 @@ static struct option builtin_commit_options[] = {
OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
OPT_FILENAME('t', "template", &template_file, "use specified template file"),
OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"),
+ OPT_BOOLEAN(0, "status", &include_status, "include status in commit message template"),
OPT_GROUP("Commit contents options"),
OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
@@ -547,7 +548,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
/* This checks if committer ident is explicitly given */
git_committer_info(0);
- if (use_editor) {
+ if (use_editor && include_status) {
char *author_ident;
const char *committer_ident;
@@ -1006,6 +1007,10 @@ static int git_commit_config(const char *k, const char *v, void *cb)
if (!strcmp(k, "commit.template"))
return git_config_pathname(&template_file, k, v);
+ if (!strcmp(k, "commit.status")) {
+ include_status = git_config_bool(k, v);
+ return 0;
+ }
return git_status_config(k, v, s);
}