git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin-commit: Fix git-commit honoring status.color

From
Ping Yin <pkufranky@gmail.com>
Date
Nov 19, 2007, 18:26 UTC
Message-ID
<46dff0320711191026l6d749886y4fd3879f555c6107@mail.gmail.com>
In-Reply-To
<7vejenuy4i.fsf@gitster.siamese.dyndns.org>
Show 10 quoted lines
>
> Although I admit I do not care much about the "status color", I
> suspect this patch is not quite right.
>
> When prepare_log_message() returns "no committable changes" and
> we are not in merge, the calling cmd_commit() does another
> run_status() to show the status of the index and the work tree
> to the stdout, and at that point, we _do_ want to honor the
> configuration setting you are discarding with this assignment.
>

You're right. I forgot about untracked files when there are 'no committable changes'

Show 43 quoted lines
> ---
>
>  builtin-commit.c |    5 ++++-
>  wt-status.h      |    1 +
>  2 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-commit.c b/builtin-commit.c
> index 4e2f4aa..058cd32 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -300,7 +300,7 @@ static const char sign_off_header[] = "Signed-off-by: ";
>  static int prepare_log_message(const char *index_file, const char *prefix)
>  {
>         struct stat statbuf;
> -       int commitable;
> +       int commitable, saved_color_setting;
>         struct strbuf sb;
>         char *buffer;
>         FILE *fp;
> @@ -383,7 +383,10 @@ static int prepare_log_message(const char *index_file, const char *prefix)
>         if (only_include_assumed)
>                 fprintf(fp, "# %s\n", only_include_assumed);
>
> +       saved_color_setting = wt_status_use_color;
> +       wt_status_use_color = 0;
>         commitable = run_status(fp, index_file, prefix);
> +       wt_status_use_color = saved_color_setting;
>
>         fclose(fp);
>
> diff --git a/wt-status.h b/wt-status.h
> index f58ebcb..225fb4d 100644
> --- a/wt-status.h
> +++ b/wt-status.h
> @@ -27,6 +27,7 @@ struct wt_status {
>  };
>
>  int git_status_config(const char *var, const char *value);
> +int wt_status_use_color;
>  void wt_status_prepare(struct wt_status *s);
>  void wt_status_print(struct wt_status *s);
>
>
-- 
Ping Yin
Previous: Junio C Hamano
Message 4 of 4 in “builtin-commit: Fix git-commit honoring status.color”
  1. builtin-commit: Fix git-commit honoring status.colorPing Yin, Nov 18, 2007
  2. Junio C HamanoNov 18, 2007
  3. builtin-commit: run commit-msg hook with correct message fileJunio C Hamano, Nov 18, 2007
  4. Ping YinNov 19, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.