diff options
| author | Matthieu Moy <Matthieu.Moy@imag.fr> | 2013-09-06 19:43:07 +0200 | 
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2013-09-06 13:33:18 -0700 | 
| commit | 2556b9962e7c0353d562b7bf70eed11d8f29d0b0 (patch) | |
| tree | 7f1e9ca52eac054c468bd7ab54e8be32940907a5 /builtin/commit.c | |
| parent | 3ba7407b8b7b7a75f720641327207d6cfdb163a2 (diff) | |
| download | git-2556b9962e7c0353d562b7bf70eed11d8f29d0b0.tar.gz | |
status: disable display of '#' comment prefix by default
Historically, "git status" needed to prefix each output line with '#' so
that the output could be added as comment to the commit message. This
prefix comment has no real purpose when "git status" is ran from the
command-line, and this may distract users from the real content.
Disable this prefix comment by default, and make it re-activable for
users needing backward compatibility with status.displayCommentPrefix.
Obviously, "git commit" ignores status.displayCommentPrefix and keeps the
comment unconditionnaly when writing to COMMIT_EDITMSG (but not when
writing to stdout for an error message or with --dry-run).
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
| -rw-r--r-- | builtin/commit.c | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/builtin/commit.c b/builtin/commit.c index 10acc53f80..61975ad1df 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -599,6 +599,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,  	const char *hook_arg2 = NULL;  	int ident_shown = 0;  	int clean_message_contents = (cleanup_mode != CLEANUP_NONE); +	int old_display_comment_prefix;  	/* This checks and barfs if author is badly specified */  	determine_author_info(author_ident); @@ -696,6 +697,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix,  	if (s->fp == NULL)  		die_errno(_("could not open '%s'"), git_path(commit_editmsg)); +	/* Ignore status.displayCommentPrefix: we do need comments in COMMIT_EDITMSG. */ +	old_display_comment_prefix = s->display_comment_prefix; +	s->display_comment_prefix = 1; +  	if (clean_message_contents)  		stripspace(&sb, 0); @@ -821,6 +826,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,  	 */  	if (!commitable && whence != FROM_MERGE && !allow_empty &&  	    !(amend && is_a_merge(current_head))) { +		s->display_comment_prefix = old_display_comment_prefix;  		run_status(stdout, index_file, prefix, 0, s);  		if (amend)  			fputs(_(empty_amend_advice), stderr); @@ -1182,6 +1188,10 @@ static int git_status_config(const char *k, const char *v, void *cb)  		s->use_color = git_config_colorbool(k, v);  		return 0;  	} +	if (!strcmp(k, "status.displaycommentprefix")) { +		s->display_comment_prefix = git_config_bool(k, v); +		return 0; +	}  	if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {  		int slot = parse_status_slot(k, 13);  		if (slot < 0) | 
