git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Stephen Kent <smkent@smkent.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add color slots for branch names in "git status --short --branch"
Date: Thu, 20 Apr 2017 02:16:53 -0400	[thread overview]
Message-ID: <20170420061653.y3bhdzw6sx5zavfc@sigill.intra.peff.net> (raw)
In-Reply-To: <201704556286334.8b7dc718029e6dd189dadb3703bfa@localhost>

Overall this looks good. A few minor nits:

On Wed, Apr 19, 2017 at 10:57:08PM -0700, Stephen Kent wrote:

> Subject: Re: [PATCH] Add color slots for branch names in "git status --short

We usually try to use "subsystem: blah" for our subjects, which makes
them easy to parse when you're looking through a oneline. So probably:

  status: add color config slots for branch names

or something.

> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 475e874..96e9cf8 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1137,7 +1137,10 @@ color.status.<slot>::
>  	`untracked` (files which are not tracked by Git),
>  	`branch` (the current branch),
>  	`nobranch` (the color the 'no branch' warning is shown in, defaulting
> -	to red), or
> +	to red),
> +	`localBranch` or `remoteBranch` (the local and remote branch names,
> +	respectively, when branch and tracking information is displayed in the
> +	status short-format), or

I wondered if this "short-format" was accurate. But indeed, we do not
seem to color the local/remote branch specially in long-format mode, so
it really is only the short format that is affected.

> diff --git a/builtin/commit.c b/builtin/commit.c
> index 4e288bc..43846d5 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1263,6 +1263,10 @@ static int parse_status_slot(const char *slot)
>  		return WT_STATUS_NOBRANCH;
>  	if (!strcasecmp(slot, "unmerged"))
>  		return WT_STATUS_UNMERGED;
> +	if (!strcasecmp(slot, "localBranch"))
> +		return WT_STATUS_LOCAL_BRANCH;
> +	if (!strcasecmp(slot, "remoteBranch"))
> +		return WT_STATUS_REMOTE_BRANCH;

Normally we match config names in the code as all lowercase, since the
key names we get from the config parser will be normalized. Here it
works with your mixed-case because you're using strcasecmp(). Obviously
that was picked up from the surrounding code, but I think those existing
strcasecmp() calls could (and perhaps should) just be strcmp().

I don't know if it's worth converting them or not. If we leave them all
as strcasecmp(), I don't mind your camelCase names, for readability.

-Peff

  reply	other threads:[~2017-04-20  6:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  5:57 [PATCH] Add color slots for branch names in "git status --short --branch" Stephen Kent
2017-04-20  6:16 ` Jeff King [this message]
2017-04-20  6:30 ` Junio C Hamano
2017-04-22  5:40   ` Stephen Kent
2017-04-27  8:54     ` Jeff King

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=20170420061653.y3bhdzw6sx5zavfc@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=smkent@smkent.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).