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

[PATCH] status: allow branch info color customization

From
Alexander 'z33ky' Hirsch <1zeeky@gmail.com>
Date
Oct 16, 2013, 08:22 UTC
Message-ID
<1381911773-9564-1-git-send-email-1zeeky@gmail.com>
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
Next: Junio C Hamano
Message 1 of 2 in “status: allow branch info color customization”
  1. status: allow branch info color customizationAlexander 'z33ky' Hirsch, Oct 16, 2013
  2. Junio C HamanoOct 16, 2013

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.