{"thread":{"id":"42758","subject":"[PATCH] log: decorate HEAD -> branch with the same color for branch and HEAD","startedAt":"2016-06-30T16:40:49Z","lastAt":"2016-07-09T12:50:08Z","messageCount":6,"participants":["Nguyễn Thái Ngọc Duy","Duy Nguyen","Jeff King","Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"290602","messageId":"20160630163942.8353-1-pclouds@gmail.com","threadId":"42758","inReplyTo":null,"subject":"[PATCH] log: decorate HEAD -> branch with the same color for branch and HEAD","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2016-06-30T16:39:42Z","receivedAt":"2016-06-30T16:40:49Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Commit 76c61fb (log: decorate HEAD with branch name under\n--decorate=full, too - 2015-05-13) adds \"HEAD -> branch\" decoration to\nshow current branch vs detached HEAD. The sign of whether HEAD is\ndetached or not is \"->\" (vs \", \"). It's too subtle for my poor\neyes. If color is used, we can make the branch name's color the same\nas HEAD to visually emphasize that it's the current branch.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n For the original discussion of 76c61fb see\n http://thread.gmane.org/gmane.comp.version-control.git/263922\n\n log-tree.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 78a5381..440e7cc 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -267,7 +267,7 @@ void format_decorations_extended(struct strbuf *sb,\n \t\t\t\tstrbuf_addstr(sb, color_commit);\n \t\t\t\tstrbuf_addstr(sb, \" -> \");\n \t\t\t\tstrbuf_addstr(sb, color_reset);\n-\t\t\t\tstrbuf_addstr(sb, decorate_get_color(use_color, current_and_HEAD->type));\n+\t\t\t\tstrbuf_addstr(sb, decorate_get_color(use_color, DECORATION_REF_HEAD));\n \t\t\t\tshow_name(sb, current_and_HEAD);\n \t\t\t}\n \t\t\tstrbuf_addstr(sb, color_reset);\n-- \n2.8.2.531.gd073806\n\n"},{"id":"290603","messageId":"CACsJy8A6DvSC=X_YU=NhLWR+O5GgfKPqduWbS_ZbjMBi10tQVg@mail.gmail.com","threadId":"42758","inReplyTo":"20160630163942.8353-1-pclouds@gmail.com","subject":"Re: [PATCH] log: decorate HEAD -> branch with the same color for branch and HEAD","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-06-30T16:43:26Z","receivedAt":"2016-06-30T16:44:16Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Jun 30, 2016 at 6:39 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:\n> Commit 76c61fb (log: decorate HEAD with branch name under\n> --decorate=full, too - 2015-05-13)\n\n.. and I got the commit wrong. It should be 51ff0f2 (log: decorate\nHEAD with branch name - 2015-03-10)\n\nadds \"HEAD -> branch\" decoration to\n> show current branch vs detached HEAD. The sign of whether HEAD is\n> detached or not is \"->\" (vs \", \"). It's too subtle for my poor\n> eyes. If color is used, we can make the branch name's color the same\n> as HEAD to visually emphasize that it's the current branch.\n-- \nDuy\n"},{"id":"290633","messageId":"20160701063129.GC5358@sigill.intra.peff.net","threadId":"42758","inReplyTo":"20160630163942.8353-1-pclouds@gmail.com","subject":"Re: [PATCH] log: decorate HEAD -> branch with the same color for branch and HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-01T06:31:29Z","receivedAt":"2016-07-01T06:31:41Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 30, 2016 at 06:39:42PM +0200, Nguyễn Thái Ngọc Duy wrote:\n\n> Commit 76c61fb (log: decorate HEAD with branch name under\n> --decorate=full, too - 2015-05-13) adds \"HEAD -> branch\" decoration to\n> show current branch vs detached HEAD. The sign of whether HEAD is\n> detached or not is \"->\" (vs \", \"). It's too subtle for my poor\n> eyes. If color is used, we can make the branch name's color the same\n> as HEAD to visually emphasize that it's the current branch.\n\nHmm. I think I like this, as it uses color to make the grouping between\nHEAD and its referent more clear.\n\nWe do already use colors to indicate \"type\", though. Which means:\n\n  1. The branch now uses the \"symref\" color. Probably OK, as that is the\n     point of the grouping (I wonder if the \"->\" in the middle should\n     match in color, too).\n\n  2. We used to color based on current_and_HEAD->type, but now that\n     information isn't conveyed. However, can this really ever have been\n     anything _except_ a branch?\n\n-Peff\n"},{"id":"290666","messageId":"a7d7d959-1189-8170-04f4-ab097202ff45@drmicha.warpmail.net","threadId":"42758","inReplyTo":"20160701063129.GC5358@sigill.intra.peff.net","subject":"Re: [PATCH] log: decorate HEAD -> branch with the same color for branch and HEAD","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2016-07-01T14:20:20Z","receivedAt":"2016-07-01T14:20:58Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jeff King venit, vidit, dixit 01.07.2016 08:31:\n> On Thu, Jun 30, 2016 at 06:39:42PM +0200, Nguyễn Thái Ngọc Duy wrote:\n> \n>> Commit 76c61fb (log: decorate HEAD with branch name under\n>> --decorate=full, too - 2015-05-13) adds \"HEAD -> branch\" decoration to\n>> show current branch vs detached HEAD. The sign of whether HEAD is\n>> detached or not is \"->\" (vs \", \"). It's too subtle for my poor\n>> eyes. If color is used, we can make the branch name's color the same\n>> as HEAD to visually emphasize that it's the current branch.\n> \n> Hmm. I think I like this, as it uses color to make the grouping between\n> HEAD and its referent more clear.\n> \n> We do already use colors to indicate \"type\", though. Which means:\n> \n>   1. The branch now uses the \"symref\" color. Probably OK, as that is the\n>      point of the grouping (I wonder if the \"->\" in the middle should\n>      match in color, too).\n> \n>   2. We used to color based on current_and_HEAD->type, but now that\n>      information isn't conveyed. However, can this really ever have been\n>      anything _except_ a branch?\n> \n> -Peff\n> \n\nSo, I rechecked, and I'm afraid I don't like the proposal.\n\nCurrently, we have a clear color code that colors refs according their\ntype (local branch, remote branch, tag, symref). This also corresponds\nto status colors, for example.\n\nUnder the proposal, a checked out branch would not be colored like a\nlocal branch - note that back then, the result of the discussion was:\n\n- If a branch foo is checked out, do not decorate by \"foo\", but amend\nthe HEAD decoration with \"foo\" and a symbol that denotes the connection.\n\nSo, \"HEAD -> foo\" is an intentional union of two decorations.\n\nI wouldn't mind changing the color of \"- > foo\" if it were just an\naddition to \"HEAD\", but it is not - it's the decoration by the local\nbranch foo.\n\nWith git branch, we use \"*\" as a symbol for the checked out branch...\n\nMichael\n"},{"id":"290668","messageId":"CACsJy8Df29zR4bJynHvwOFQobVS8X-08D9K1UPs7QYXd_bkCCg@mail.gmail.com","threadId":"42758","inReplyTo":"a7d7d959-1189-8170-04f4-ab097202ff45@drmicha.warpmail.net","subject":"Re: [PATCH] log: decorate HEAD -> branch with the same color for branch and HEAD","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-07-01T15:13:27Z","receivedAt":"2016-07-01T15:22:27Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Jul 1, 2016 at 4:20 PM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Jeff King venit, vidit, dixit 01.07.2016 08:31:\n>> On Thu, Jun 30, 2016 at 06:39:42PM +0200, Nguyễn Thái Ngọc Duy wrote:\n>>\n>>> Commit 76c61fb (log: decorate HEAD with branch name under\n>>> --decorate=full, too - 2015-05-13) adds \"HEAD -> branch\" decoration to\n>>> show current branch vs detached HEAD. The sign of whether HEAD is\n>>> detached or not is \"->\" (vs \", \"). It's too subtle for my poor\n>>> eyes. If color is used, we can make the branch name's color the same\n>>> as HEAD to visually emphasize that it's the current branch.\n>>\n>> Hmm. I think I like this, as it uses color to make the grouping between\n>> HEAD and its referent more clear.\n>>\n>> We do already use colors to indicate \"type\", though. Which means:\n>>\n>>   1. The branch now uses the \"symref\" color. Probably OK, as that is the\n>>      point of the grouping (I wonder if the \"->\" in the middle should\n>>      match in color, too).\n>>\n>>   2. We used to color based on current_and_HEAD->type, but now that\n>>      information isn't conveyed. However, can this really ever have been\n>>      anything _except_ a branch?\n>>\n>> -Peff\n>>\n>\n> So, I rechecked, and I'm afraid I don't like the proposal.\n\n\nHow about a middle ground: change color of the arrow (easier to catch\neyes) and leave the associated branch alone.\n\n>\n> Currently, we have a clear color code that colors refs according their\n> type (local branch, remote branch, tag, symref). This also corresponds\n> to status colors, for example.\n>\n> Under the proposal, a checked out branch would not be colored like a\n> local branch - note that back then, the result of the discussion was:\n>\n> - If a branch foo is checked out, do not decorate by \"foo\", but amend\n> the HEAD decoration with \"foo\" and a symbol that denotes the connection.\n>\n> So, \"HEAD -> foo\" is an intentional union of two decorations.\n>\n> I wouldn't mind changing the color of \"- > foo\" if it were just an\n> addition to \"HEAD\", but it is not - it's the decoration by the local\n> branch foo.\n>\n> With git branch, we use \"*\" as a symbol for the checked out branch...\n>\n> Michael\n\n\n\n-- \nDuy\n"},{"id":"291101","messageId":"20160709124949.5363-1-pclouds@gmail.com","threadId":"42758","inReplyTo":"CACsJy8Df29zR4bJynHvwOFQobVS8X-08D9K1UPs7QYXd_bkCCg@mail.gmail.com","subject":"[PATCH v2] log: decorate HEAD -> branch with the same color for arrow and HEAD","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2016-07-09T12:49:49Z","receivedAt":"2016-07-09T12:50:08Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Commit 76c61fb (log: decorate HEAD with branch name under\n--decorate=full, too - 2015-05-13) adds \"HEAD -> branch\" decoration to\nshow current branch vs detached HEAD. The sign of whether HEAD is\ndetached or not is \"->\" (vs \",\") because the branch is always colored\nby type. Color the arrow the same as HEAD to visually emphasize that\nthe following branch is HEAD, without paying too much attention to the\nactual separators \"->\" or \",\"\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n I'm going to take Michael's silence as no objection to the recoloring\n the arrow. So v2 changes the arrow's color instead of the branch's.\n\n log-tree.c                       | 2 --\n t/t4207-log-decoration-colors.sh | 2 +-\n 2 files changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 78a5381..e647b08 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -263,8 +263,6 @@ void format_decorations_extended(struct strbuf *sb,\n \n \t\t\tif (current_and_HEAD &&\n \t\t\t    decoration->type == DECORATION_REF_HEAD) {\n-\t\t\t\tstrbuf_addstr(sb, color_reset);\n-\t\t\t\tstrbuf_addstr(sb, color_commit);\n \t\t\t\tstrbuf_addstr(sb, \" -> \");\n \t\t\t\tstrbuf_addstr(sb, color_reset);\n \t\t\t\tstrbuf_addstr(sb, decorate_get_color(use_color, current_and_HEAD->type));\ndiff --git a/t/t4207-log-decoration-colors.sh b/t/t4207-log-decoration-colors.sh\nindex f8008b6..b972296 100755\n--- a/t/t4207-log-decoration-colors.sh\n+++ b/t/t4207-log-decoration-colors.sh\n@@ -44,7 +44,7 @@ test_expect_success setup '\n '\n \n cat >expected <<EOF\n-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}${c_commit} ->\\\n+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD ->\\\n  ${c_reset}${c_branch}master${c_reset}${c_commit},\\\n  ${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit},\\\n  ${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B\n-- \n2.8.2.537.g0965dd9\n\n"}]}