diff options
| author | Junio C Hamano <gitster@pobox.com> | 2013-09-20 12:36:31 -0700 | 
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2013-09-20 12:36:32 -0700 | 
| commit | b4980c63acad8457fb3606b9bd8b74d5e7cba8dd (patch) | |
| tree | 28b33ae1ae49f2e6ab3215f95a58b9068254998d /builtin/commit.c | |
| parent | 9a86b899415c8a49cc33d6b43bcab8113ddca517 (diff) | |
| parent | ea9882bfc4d2850b65eac29ac5152e0d778a744b (diff) | |
| download | git-b4980c63acad8457fb3606b9bd8b74d5e7cba8dd.tar.gz | |
Merge branch 'mm/commit-template-squelch-advice-messages'
From the commit log template, remove irrelevant "advice" messages
that are shared with "git status" output.
* mm/commit-template-squelch-advice-messages:
  commit: disable status hints when writing to COMMIT_EDITMSG
  wt-status: turn advice_status_hints into a field of wt_status
  commit: factor status configuration is a helper function
Diffstat (limited to 'builtin/commit.c')
| -rw-r--r-- | builtin/commit.c | 25 | 
1 files changed, 17 insertions, 8 deletions
| diff --git a/builtin/commit.c b/builtin/commit.c index 29d4225ff2..6ab4605cf5 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -164,6 +164,15 @@ static void determine_whence(struct wt_status *s)  		s->whence = whence;  } +static void status_init_config(struct wt_status *s, config_fn_t fn) +{ +	wt_status_prepare(s); +	gitmodules_config(); +	git_config(fn, s); +	determine_whence(s); +	s->hints = advice_status_hints; /* must come after git_config() */ +} +  static void rollback_index_files(void)  {  	switch (commit_style) { @@ -700,6 +709,12 @@ static int prepare_to_commit(const char *index_file, const char *prefix,  	old_display_comment_prefix = s->display_comment_prefix;  	s->display_comment_prefix = 1; +	/* +	 * Most hints are counter-productive when the commit has +	 * already started. +	 */ +	s->hints = 0; +  	if (clean_message_contents)  		stripspace(&sb, 0); @@ -1260,10 +1275,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)  	if (argc == 2 && !strcmp(argv[1], "-h"))  		usage_with_options(builtin_status_usage, builtin_status_options); -	wt_status_prepare(&s); -	gitmodules_config(); -	git_config(git_status_config, &s); -	determine_whence(&s); +	status_init_config(&s, git_status_config);  	argc = parse_options(argc, argv, prefix,  			     builtin_status_options,  			     builtin_status_usage, 0); @@ -1505,11 +1517,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)  	if (argc == 2 && !strcmp(argv[1], "-h"))  		usage_with_options(builtin_commit_usage, builtin_commit_options); -	wt_status_prepare(&s); -	gitmodules_config(); -	git_config(git_commit_config, &s); +	status_init_config(&s, git_commit_config);  	status_format = STATUS_FORMAT_NONE; /* Ignore status.short */ -	determine_whence(&s);  	s.colopts = 0;  	if (get_sha1("HEAD", sha1)) | 
