{"thread":{"id":"35149","subject":"[PATCH] status: allow branch info color customization","startedAt":"2013-10-16T08:22:53Z","lastAt":"2013-10-16T21:39:59Z","messageCount":2,"participants":["Alexander 'z33ky' Hirsch","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"229062","messageId":"1381911773-9564-1-git-send-email-1zeeky@gmail.com","threadId":"35149","inReplyTo":null,"subject":"[PATCH] status: allow branch info color customization","fromName":"Alexander 'z33ky' Hirsch","fromEmail":"1zeeky@gmail.com","sentAt":"2013-10-16T08:22:53Z","receivedAt":"2013-10-16T08:22:53Z","isPatch":true,"sender":{"key":"1zeeky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/289819?v=4"},"body":"From: Alexander Hirsch <1zeeky@gmail.com>\n\ngit status -bs (--branch --short) does not seem to allow customization of the\ncolors for the local and remote branch.\nThis patch adds these via the color.status.local and color.status.remote\nconfig variables.\n\nGiven the trivial nature of this patch I did not write a test for it. I did a\nsmall check that it's working so, to be on the safe side.\n\nSigned-off-by: Alexander Hirsch <1zeeky@gmail.com>\n---\n Documentation/config.txt | 7 +++++--\n builtin/commit.c         | 4 ++++\n 2 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d4d93c9..261fc99 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -904,9 +904,12 @@ color.status.<slot>::\n \t`added` or `updated` (files which are added but not committed),\n \t`changed` (files which are changed but not added in the index),\n \t`untracked` (files which are not tracked by Git),\n-\t`branch` (the current branch), or\n+\t`branch` (the current branch),\n \t`nobranch` (the color the 'no branch' warning is shown in, defaulting\n-\tto red). The values of these variables may be specified as in\n+\tto red),\n+\t`local` (the local branch when showing branch info), or\n+\t`remote` (the remote-tracked branch when showing branch info).\n+\tThe values of these variables may be specified as in\n \tcolor.branch.<slot>.\n \n color.ui::\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 6ab4605..43365b4 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1165,6 +1165,10 @@ static int parse_status_slot(const char *var, int offset)\n \t\treturn WT_STATUS_HEADER;\n \tif (!strcasecmp(var+offset, \"branch\"))\n \t\treturn WT_STATUS_ONBRANCH;\n+\tif (!strcasecmp(var+offset, \"local\"))\n+\t\treturn WT_STATUS_LOCAL_BRANCH;\n+\tif (!strcasecmp(var+offset, \"remote\"))\n+\t\treturn WT_STATUS_REMOTE_BRANCH;\n \tif (!strcasecmp(var+offset, \"updated\")\n \t\t|| !strcasecmp(var+offset, \"added\"))\n \t\treturn WT_STATUS_UPDATED;\n-- \n1.8.4.1\n"},{"id":"229095","messageId":"xmqqzjq851zk.fsf@gitster.dls.corp.google.com","threadId":"35149","inReplyTo":"1381911773-9564-1-git-send-email-1zeeky@gmail.com","subject":"Re: [PATCH] status: allow branch info color customization","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-16T21:39:59Z","receivedAt":"2013-10-16T21:39:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexander 'z33ky' Hirsch <1zeeky@gmail.com> writes:\n\n> From: Alexander Hirsch <1zeeky@gmail.com>\n>\n> git status -bs (--branch --short) does not seem to allow customization of the\n> colors for the local and remote branch.\n\nwt-status can use the following colors:\n\n    WT_STATUS_CHANGED\n    WT_STATUS_HEADER\n  - WT_STATUS_LOCAL_BRANCH\n    WT_STATUS_NOBRANCH\n    WT_STATUS_ONBRANCH\n  - WT_STATUS_REMOTE_BRANCH\n    WT_STATUS_UNMERGED\n    WT_STATUS_UNTRACKED\n    WT_STATUS_UPDATED\n\nbut parse_status_slot() lets you set only these\n\n    WT_STATUS_CHANGED\n    WT_STATUS_HEADER\n    WT_STATUS_NOBRANCH\n    WT_STATUS_ONBRANCH\n    WT_STATUS_UNMERGED\n    WT_STATUS_UNTRACKED\n    WT_STATUS_UPDATED\n\nand this patch makes the configuration mechanism cover all of the\nslots by adding parsing code for the missing two.\n\nWhile I think the intent of the patch makes sense, I have to wonder\nif \"local\" and \"remote\" without having the \"branch\" anywhere is\npainting us into an unpleasant corner we cannot later get out\nof. For example, we might want to show the remote-tracking branch\ninformation (that is where REMOTE_BRANCH color matters in the\ncurrent code) in a more detailed way later, which may include where\nthe source repository resides, either locally on the same host or\nremotely over the network, and WT_STATUS_{LOCAL,REMOTE}_REPOSITORY\nmay be the natural names for the colors to paint the repository\npaths/URL in.\n"}]}