From: Phillip Wood <phillip.wood123@gmail.com>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Cc: Philippe Blain <levraiphilippeblain@gmail.com>,
Jeff King <peff@peff.net>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2 04/11] add -i: use `reset_color` consistently
Date: Fri, 13 Nov 2020 12:03:59 +0000 [thread overview]
Message-ID: <6405f7c9-b084-ed48-e33e-009f388933bf@gmail.com> (raw)
In-Reply-To: <c857c4493213bd7cc4d057487db2d1a74fa0bbd6.1605097704.git.gitgitgadget@gmail.com>
Hi Dscho
On 11/11/2020 12:28, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> We already maintain a list of colors in the `add_i_state`, therefore we
> should use them.
Playing devil's advocate for a moment - why do we have a reset entry in
that list? The next patch makes sure it cannot be customized which is a
good thing so why not drop the `reset` member from `add_i_state`
entirely? The perl version needed to get the reset string from `git
config` and store it somewhere but in the C version we have a perfectly
good constant we can use instead.
Best Wishes
Phillip
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> add-patch.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/add-patch.c b/add-patch.c
> index b6d53229bb..bf89c43145 100644
> --- a/add-patch.c
> +++ b/add-patch.c
> @@ -672,7 +672,7 @@ static void render_hunk(struct add_p_state *s, struct hunk *hunk,
> if (len)
> strbuf_add(out, p, len);
> else if (colored)
> - strbuf_addf(out, "%s\n", GIT_COLOR_RESET);
> + strbuf_addf(out, "%s\n", s->s.reset_color);
> else
> strbuf_addch(out, '\n');
> }
> @@ -1065,7 +1065,7 @@ static void recolor_hunk(struct add_p_state *s, struct hunk *hunk)
> s->s.file_new_color :
> s->s.context_color);
> strbuf_add(&s->colored, plain + current, eol - current);
> - strbuf_addstr(&s->colored, GIT_COLOR_RESET);
> + strbuf_addstr(&s->colored, s->s.reset_color);
> if (next > eol)
> strbuf_add(&s->colored, plain + eol, next - eol);
> current = next;
>
next prev parent reply other threads:[~2020-11-13 12:04 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 23:42 [PATCH 0/9] Fix color handling in git add -i Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 1/9] add -i (built-in): do show an error message for incorrect inputs Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 2/9] add -i (built-in): send error messages to stderr Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 3/9] add -i: use `reset_color` consistently Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 4/9] add -i (built-in): prevent the `reset` "color" from being configured Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 5/9] add -i (built-in): use correct names to load color.diff.* config Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 6/9] add -p (built-in): do not color the progress indicator separately Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 7/9] add -i (built-in): use the same indentation as the Perl version Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 8/9] add -i (Perl version): include indentation in the colored header Johannes Schindelin via GitGitGadget
2020-11-10 23:42 ` [PATCH 9/9] add -i: verify in the tests that colors can be overridden Johannes Schindelin via GitGitGadget
2020-11-11 2:35 ` Jeff King
2020-11-11 15:53 ` Johannes Schindelin
2020-11-11 18:07 ` Jeff King
2020-11-12 14:04 ` Johannes Schindelin
2020-11-12 18:29 ` Jeff King
2020-11-15 23:35 ` Johannes Schindelin
2020-11-17 1:44 ` Jeff King
2020-11-11 2:36 ` [PATCH 0/9] Fix color handling in git add -i Jeff King
2020-11-11 12:28 ` [PATCH v2 00/11] " Johannes Schindelin via GitGitGadget
2020-11-11 12:28 ` [PATCH v2 01/11] add -i (built-in): do show an error message for incorrect inputs Johannes Schindelin via GitGitGadget
2020-11-11 12:28 ` [PATCH v2 02/11] add -i (built-in): send error messages to stderr Johannes Schindelin via GitGitGadget
2020-11-11 12:28 ` [PATCH v2 03/11] add -p (built-in): imitate `xdl_format_hunk_hdr()` generating hunk headers Johannes Schindelin via GitGitGadget
2020-11-11 12:28 ` [PATCH v2 04/11] add -i: use `reset_color` consistently Johannes Schindelin via GitGitGadget
2020-11-13 12:03 ` Phillip Wood [this message]
2020-11-13 13:53 ` Johannes Schindelin
2020-11-13 16:04 ` Phillip Wood
2020-11-15 23:47 ` Johannes Schindelin
2020-11-11 12:28 ` [PATCH v2 05/11] add -i (built-in): prevent the `reset` "color" from being configured Johannes Schindelin via GitGitGadget
2020-11-11 12:28 ` [PATCH v2 06/11] add -i (built-in): use correct names to load color.diff.* config Johannes Schindelin via GitGitGadget
2020-11-11 12:28 ` [PATCH v2 07/11] add -p (built-in): do not color the progress indicator separately Johannes Schindelin via GitGitGadget
2020-11-13 12:07 ` Phillip Wood
2020-11-13 13:57 ` Johannes Schindelin
2020-11-13 16:06 ` Phillip Wood
2020-11-15 23:55 ` Johannes Schindelin
2020-11-11 12:28 ` [PATCH v2 08/11] add -i (built-in): use the same indentation as the Perl version Johannes Schindelin via GitGitGadget
2020-11-11 12:28 ` [PATCH v2 09/11] add -i (Perl version): include indentation in the colored header Johannes Schindelin via GitGitGadget
2020-11-13 12:11 ` Phillip Wood
2020-11-13 13:58 ` Johannes Schindelin
2020-11-13 16:12 ` Phillip Wood
2020-11-15 23:51 ` Johannes Schindelin
2020-11-11 12:28 ` [PATCH v2 10/11] add -p: prefer color.diff.context over color.diff.plain Johannes Schindelin via GitGitGadget
2020-11-13 14:04 ` Philippe Blain
2020-11-15 23:57 ` Johannes Schindelin
2020-11-13 14:08 ` Phillip Wood
2020-11-16 0:02 ` Johannes Schindelin
2020-11-11 12:28 ` [PATCH v2 11/11] add -i: verify in the tests that colors can be overridden Johannes Schindelin via GitGitGadget
2020-11-11 18:45 ` [PATCH v2 00/11] Fix color handling in git add -i Jeff King
2020-11-12 14:20 ` Johannes Schindelin
2020-11-12 18:40 ` Jeff King
2020-11-15 23:40 ` Johannes Schindelin
2020-11-17 1:49 ` Jeff King
2020-11-16 16:08 ` [PATCH v3 " Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 01/11] add -i (built-in): do show an error message for incorrect inputs Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 02/11] add -i (built-in): send error messages to stderr Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 03/11] add -p (built-in): imitate `xdl_format_hunk_hdr()` generating hunk headers Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 04/11] add -i: use `reset_color` consistently Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 05/11] add -i (built-in): prevent the `reset` "color" from being configured Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 06/11] add -i (built-in): use correct names to load color.diff.* config Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 07/11] add -p (built-in): do not color the progress indicator separately Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 08/11] add -i (built-in): use the same indentation as the Perl version Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 09/11] add -i (Perl version): color header to match the C version Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 10/11] add -p: prefer color.diff.context over color.diff.plain Johannes Schindelin via GitGitGadget
2020-11-16 16:08 ` [PATCH v3 11/11] add -i: verify in the tests that colors can be overridden Johannes Schindelin via GitGitGadget
2020-11-17 1:51 ` [PATCH v3 00/11] Fix color handling in git add -i Jeff King
2020-11-17 2:05 ` Jeff King
2020-11-25 21:59 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6405f7c9-b084-ed48-e33e-009f388933bf@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
--cc=levraiphilippeblain@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).