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

[PATCH] Colorize the branch's name in the status' output

From
prouleau72@gmail.com <prouleau72@gmail.com>
Date
Aug 26, 2010, 00:09 UTC
Message-ID
<1282781349-1899-1-git-send-email-prouleau72@gmail.com>
From: Patryck Rouleau <PRouleau72@gmail.com>
When we are not on a branch, the message "Not currently on any branch." is
show in red. This patch makes the branch's name more visible by showing it
in green (the color of local branch).
---
 wt-status.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 54b6b03..5497ef3 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -629,7 +629,7 @@ static void wt_status_print_tracking(struct wt_status *s)
 
 void wt_status_print(struct wt_status *s)
 {
-	const char *branch_color = color(WT_STATUS_HEADER, s);
+	const char *status_color = color(WT_STATUS_HEADER, s);
 
 	if (s->branch) {
 		const char *on_what = "On branch ";
@@ -638,11 +638,12 @@ void wt_status_print(struct wt_status *s)
 			branch_name += 11;
 		else if (!strcmp(branch_name, "HEAD")) {
 			branch_name = "";
-			branch_color = color(WT_STATUS_NOBRANCH, s);
+			status_color = color(WT_STATUS_NOBRANCH, s);
 			on_what = "Not currently on any branch.";
 		}
 		color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "# ");
-		color_fprintf_ln(s->fp, branch_color, "%s%s", on_what, branch_name);
+		color_fprintf(s->fp, status_color, "%s", on_what);
+		color_fprintf_ln(s->fp, color(WT_STATUS_LOCAL_BRANCH, s), "%s", branch_name);
 		if (!s->is_initial)
 			wt_status_print_tracking(s);
 	}
-- 
1.7.1
Message 1 of 1 in “Colorize the branch's name in the status' output”
  1. Colorize the branch's name in the status' outputprouleau72@gmail.com, Aug 26, 2010

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.