{"thread":{"id":"45774","subject":"[PATCH v2] status: add color config slots for branch info in \"--short --branch\"","startedAt":"2017-04-22T05:42:10Z","lastAt":"2017-04-28T07:39:17Z","messageCount":4,"participants":["Stephen Kent","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"317536","messageId":"201704939828871.4296cfa6a746a5004d28db265800a@localhost","threadId":"45774","inReplyTo":null,"subject":"[PATCH v2] status: add color config slots for branch info in \"--short --branch\"","fromName":"Stephen Kent","fromEmail":"smkent@smkent.net","sentAt":"2017-04-22T05:42:02Z","receivedAt":"2017-04-22T05:42:10Z","isPatch":true,"sender":{"key":"smkent@smkent.net","avatar":"https://avatars.githubusercontent.com/u/2831985?v=4"},"body":"Add color config slots to be used in the status short-format when\ndisplaying local and remote tracking branch information.\n\nSigned-off-by: Stephen Kent <smkent@smkent.net>\n---\n Documentation/config.txt               | 5 ++++-\n builtin/commit.c                       | 4 ++++\n contrib/completion/git-completion.bash | 2 ++\n t/t7508-status.sh                      | 5 +++--\n 4 files changed, 13 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 475e874..96e9cf8 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1137,7 +1137,10 @@ color.status.<slot>::\n \t`untracked` (files which are not tracked by Git),\n \t`branch` (the current branch),\n \t`nobranch` (the color the 'no branch' warning is shown in, defaulting\n-\tto red), or\n+\tto red),\n+\t`localBranch` or `remoteBranch` (the local and remote branch names,\n+\trespectively, when branch and tracking information is displayed in the\n+\tstatus short-format), or\n \t`unmerged` (files which have unmerged changes).\n \n color.ui::\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 4e288bc..43846d5 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1263,6 +1263,10 @@ static int parse_status_slot(const char *slot)\n \t\treturn WT_STATUS_NOBRANCH;\n \tif (!strcasecmp(slot, \"unmerged\"))\n \t\treturn WT_STATUS_UNMERGED;\n+\tif (!strcasecmp(slot, \"localBranch\"))\n+\t\treturn WT_STATUS_LOCAL_BRANCH;\n+\tif (!strcasecmp(slot, \"remoteBranch\"))\n+\t\treturn WT_STATUS_REMOTE_BRANCH;\n \treturn -1;\n }\n \ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 1150164..f0542b6 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2377,7 +2377,9 @@ _git_config ()\n \t\tcolor.status.added\n \t\tcolor.status.changed\n \t\tcolor.status.header\n+\t\tcolor.status.localBranch\n \t\tcolor.status.nobranch\n+\t\tcolor.status.remoteBranch\n \t\tcolor.status.unmerged\n \t\tcolor.status.untracked\n \t\tcolor.status.updated\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex fb00e6d..7d42085 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -610,7 +610,8 @@ test_expect_success 'status --porcelain ignores relative paths setting' '\n test_expect_success 'setup unique colors' '\n \n \tgit config status.color.untracked blue &&\n-\tgit config status.color.branch green\n+\tgit config status.color.branch green &&\n+\tgit config status.color.localBranch yellow\n \n '\n \n@@ -675,7 +676,7 @@ test_expect_success 'status -s with color.status' '\n '\n \n cat >expect <<\\EOF\n-## <GREEN>master<RESET>\n+## <YELLOW>master<RESET>\n  <RED>M<RESET> dir1/modified\n <GREEN>A<RESET>  dir2/added\n <BLUE>??<RESET> dir1/untracked\n-- \n2.10.2\n\n"},{"id":"318062","messageId":"20170427090423.amjqi7ca4xl7pzax@sigill.intra.peff.net","threadId":"45774","inReplyTo":"201704939828871.4296cfa6a746a5004d28db265800a@localhost","subject":"Re: [PATCH v2] status: add color config slots for branch info in \"--short --branch\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-27T09:04:24Z","receivedAt":"2017-04-27T09:04:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 21, 2017 at 10:42:02PM -0700, Stephen Kent wrote:\n\n> Add color config slots to be used in the status short-format when\n> displaying local and remote tracking branch information.\n> \n> Signed-off-by: Stephen Kent <smkent@smkent.net>\n\nThis looks good to me, and I'd be happy if we took it as-is.\n\nBut...\n\n> diff --git a/t/t7508-status.sh b/t/t7508-status.sh\n> index fb00e6d..7d42085 100755\n> --- a/t/t7508-status.sh\n> +++ b/t/t7508-status.sh\n> @@ -610,7 +610,8 @@ test_expect_success 'status --porcelain ignores relative paths setting' '\n>  test_expect_success 'setup unique colors' '\n>  \n>  \tgit config status.color.untracked blue &&\n> -\tgit config status.color.branch green\n> +\tgit config status.color.branch green &&\n> +\tgit config status.color.localBranch yellow\n>  \n>  '\n>  \n> @@ -675,7 +676,7 @@ test_expect_success 'status -s with color.status' '\n>  '\n>  \n>  cat >expect <<\\EOF\n> -## <GREEN>master<RESET>\n> +## <YELLOW>master<RESET>\n\nAs we discussed elsewhere, it would be nice if this tested remoteBranch,\ntoo. IMHO the simplest thing to is to rebase it on the t7508 update I\njust posted.\n\nThe other option is to add config for remoteBranch which would do\nnothing for now, and then resolve it to check the correct colors when\nthe two topics are merged (since the test will start failing then).\nThat seems unnecessarily confusing.\n\n-Peff\n"},{"id":"318115","messageId":"xmqqo9vhkzyf.fsf@gitster.mtv.corp.google.com","threadId":"45774","inReplyTo":"20170427090423.amjqi7ca4xl7pzax@sigill.intra.peff.net","subject":"Re: [PATCH v2] status: add color config slots for branch info in \"--short --branch\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-04-28T02:50:32Z","receivedAt":"2017-04-28T02:50:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> As we discussed elsewhere, it would be nice if this tested remoteBranch,\n> too. IMHO the simplest thing to is to rebase it on the t7508 update I\n> just posted.\n>\n> The other option is to add config for remoteBranch which would do\n> nothing for now, and then resolve it to check the correct colors when\n> the two topics are merged (since the test will start failing then).\n> That seems unnecessarily confusing.\n\nYes, let's do the former.\n\nThis is to be applied on top of your\n<20170427090105.vaodugbqdaxunoin@sigill.intra.peff.net>\n\n-- >8 --\nFrom: Stephen Kent <smkent@smkent.net>\nDate: Fri, 21 Apr 2017 22:42:02 -0700\nSubject: [PATCH] status: add color config slots for branch info in \"--short --branch\"\n\nAdd color config slots to be used in the status short-format when\ndisplaying local and remote tracking branch information.\n\n[jc: rebased on top of Peff's fix to 'git status' and tweaked the\ntest to check both local and remote-tracking branch output]\n\nSigned-off-by: Stephen Kent <smkent@smkent.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/config.txt               | 5 ++++-\n builtin/commit.c                       | 4 ++++\n contrib/completion/git-completion.bash | 2 ++\n t/t7508-status.sh                      | 6 ++++--\n 4 files changed, 14 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 475e874d51..96e9cf8b73 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1137,7 +1137,10 @@ color.status.<slot>::\n \t`untracked` (files which are not tracked by Git),\n \t`branch` (the current branch),\n \t`nobranch` (the color the 'no branch' warning is shown in, defaulting\n-\tto red), or\n+\tto red),\n+\t`localBranch` or `remoteBranch` (the local and remote branch names,\n+\trespectively, when branch and tracking information is displayed in the\n+\tstatus short-format), or\n \t`unmerged` (files which have unmerged changes).\n \n color.ui::\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 1d805f5da8..9028bfacf8 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1263,6 +1263,10 @@ static int parse_status_slot(const char *slot)\n \t\treturn WT_STATUS_NOBRANCH;\n \tif (!strcasecmp(slot, \"unmerged\"))\n \t\treturn WT_STATUS_UNMERGED;\n+\tif (!strcasecmp(slot, \"localBranch\"))\n+\t\treturn WT_STATUS_LOCAL_BRANCH;\n+\tif (!strcasecmp(slot, \"remoteBranch\"))\n+\t\treturn WT_STATUS_REMOTE_BRANCH;\n \treturn -1;\n }\n \ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b617019075..72c6d58965 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2378,7 +2378,9 @@ _git_config ()\n \t\tcolor.status.added\n \t\tcolor.status.changed\n \t\tcolor.status.header\n+\t\tcolor.status.localBranch\n \t\tcolor.status.nobranch\n+\t\tcolor.status.remoteBranch\n \t\tcolor.status.unmerged\n \t\tcolor.status.untracked\n \t\tcolor.status.updated\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex a000ed4e7f..567c4d4bab 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -661,7 +661,9 @@ test_expect_success 'status --porcelain ignores relative paths setting' '\n test_expect_success 'setup unique colors' '\n \n \tgit config status.color.untracked blue &&\n-\tgit config status.color.branch green\n+\tgit config status.color.branch green &&\n+\tgit config status.color.localBranch yellow &&\n+\tgit config status.color.remoteBranch cyan\n \n '\n \n@@ -730,7 +732,7 @@ test_expect_success 'status -s with color.status' '\n '\n \n cat >expect <<\\EOF\n-## <GREEN>master<RESET>...<RED>upstream<RESET> [ahead <GREEN>1<RESET>, behind <RED>2<RESET>]\n+## <YELLOW>master<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>]\n  <RED>M<RESET> dir1/modified\n <GREEN>A<RESET>  dir2/added\n <BLUE>??<RESET> dir1/untracked\n-- \n2.13.0-rc1-211-gd5d57c8556\n\n"},{"id":"318120","messageId":"20170428073722.aivdzgwc7duwfg7h@sigill.intra.peff.net","threadId":"45774","inReplyTo":"xmqqo9vhkzyf.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] status: add color config slots for branch info in \"--short --branch\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-28T07:37:22Z","receivedAt":"2017-04-28T07:39:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Apr 27, 2017 at 07:50:32PM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > As we discussed elsewhere, it would be nice if this tested remoteBranch,\n> > too. IMHO the simplest thing to is to rebase it on the t7508 update I\n> > just posted.\n> >\n> > The other option is to add config for remoteBranch which would do\n> > nothing for now, and then resolve it to check the correct colors when\n> > the two topics are merged (since the test will start failing then).\n> > That seems unnecessarily confusing.\n> \n> Yes, let's do the former.\n> \n> This is to be applied on top of your\n> <20170427090105.vaodugbqdaxunoin@sigill.intra.peff.net>\n> \n> -- >8 --\n> From: Stephen Kent <smkent@smkent.net>\n> Date: Fri, 21 Apr 2017 22:42:02 -0700\n> Subject: [PATCH] status: add color config slots for branch info in \"--short --branch\"\n\nThanks, the result looks good to me.\n\n-Peff\n"}]}