git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] status: allow branch info color customization
@ 2013-10-16  8:22 Alexander 'z33ky' Hirsch
  2013-10-16 21:39 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander 'z33ky' Hirsch @ 2013-10-16  8:22 UTC (permalink / raw)
  To: git; +Cc: Steffen Prohaska, Alexander Hirsch

From: Alexander Hirsch <1zeeky@gmail.com>

git status -bs (--branch --short) does not seem to allow customization of the
colors for the local and remote branch.
This patch adds these via the color.status.local and color.status.remote
config variables.

Given the trivial nature of this patch I did not write a test for it. I did a
small check that it's working so, to be on the safe side.

Signed-off-by: Alexander Hirsch <1zeeky@gmail.com>
---
 Documentation/config.txt | 7 +++++--
 builtin/commit.c         | 4 ++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index d4d93c9..261fc99 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -904,9 +904,12 @@ color.status.<slot>::
 	`added` or `updated` (files which are added but not committed),
 	`changed` (files which are changed but not added in the index),
 	`untracked` (files which are not tracked by Git),
-	`branch` (the current branch), or
+	`branch` (the current branch),
 	`nobranch` (the color the 'no branch' warning is shown in, defaulting
-	to red). The values of these variables may be specified as in
+	to red),
+	`local` (the local branch when showing branch info), or
+	`remote` (the remote-tracked branch when showing branch info).
+	The values of these variables may be specified as in
 	color.branch.<slot>.
 
 color.ui::
diff --git a/builtin/commit.c b/builtin/commit.c
index 6ab4605..43365b4 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1165,6 +1165,10 @@ static int parse_status_slot(const char *var, int offset)
 		return WT_STATUS_HEADER;
 	if (!strcasecmp(var+offset, "branch"))
 		return WT_STATUS_ONBRANCH;
+	if (!strcasecmp(var+offset, "local"))
+		return WT_STATUS_LOCAL_BRANCH;
+	if (!strcasecmp(var+offset, "remote"))
+		return WT_STATUS_REMOTE_BRANCH;
 	if (!strcasecmp(var+offset, "updated")
 		|| !strcasecmp(var+offset, "added"))
 		return WT_STATUS_UPDATED;
-- 
1.8.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] status: allow branch info color customization
  2013-10-16  8:22 [PATCH] status: allow branch info color customization Alexander 'z33ky' Hirsch
@ 2013-10-16 21:39 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2013-10-16 21:39 UTC (permalink / raw)
  To: Alexander 'z33ky' Hirsch; +Cc: git, Steffen Prohaska

Alexander 'z33ky' Hirsch <1zeeky@gmail.com> writes:

> From: Alexander Hirsch <1zeeky@gmail.com>
>
> git status -bs (--branch --short) does not seem to allow customization of the
> colors for the local and remote branch.

wt-status can use the following colors:

    WT_STATUS_CHANGED
    WT_STATUS_HEADER
  - WT_STATUS_LOCAL_BRANCH
    WT_STATUS_NOBRANCH
    WT_STATUS_ONBRANCH
  - WT_STATUS_REMOTE_BRANCH
    WT_STATUS_UNMERGED
    WT_STATUS_UNTRACKED
    WT_STATUS_UPDATED

but parse_status_slot() lets you set only these

    WT_STATUS_CHANGED
    WT_STATUS_HEADER
    WT_STATUS_NOBRANCH
    WT_STATUS_ONBRANCH
    WT_STATUS_UNMERGED
    WT_STATUS_UNTRACKED
    WT_STATUS_UPDATED

and this patch makes the configuration mechanism cover all of the
slots by adding parsing code for the missing two.

While I think the intent of the patch makes sense, I have to wonder
if "local" and "remote" without having the "branch" anywhere is
painting us into an unpleasant corner we cannot later get out
of. For example, we might want to show the remote-tracking branch
information (that is where REMOTE_BRANCH color matters in the
current code) in a more detailed way later, which may include where
the source repository resides, either locally on the same host or
remotely over the network, and WT_STATUS_{LOCAL,REMOTE}_REPOSITORY
may be the natural names for the colors to paint the repository
paths/URL in.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-16 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16  8:22 [PATCH] status: allow branch info color customization Alexander 'z33ky' Hirsch
2013-10-16 21:39 ` Junio C Hamano

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).