{"thread":{"id":"28963","subject":"Uniform branch coloring","startedAt":"2011-11-17T19:08:38Z","lastAt":"2011-11-30T06:55:40Z","messageCount":2,"participants":["Nicolas Dudebout","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"179646","messageId":"CA+TMmK=476h1YyVcegWia2F+1bhOQyNLf-150qF1bnU8Wu3qJA@mail.gmail.com","threadId":"28963","inReplyTo":null,"subject":"Uniform branch coloring","fromName":"Nicolas Dudebout","fromEmail":"nicolas.dudebout@gmail.com","sentAt":"2011-11-17T19:08:38Z","receivedAt":"2011-11-17T19:08:38Z","isPatch":false,"sender":{"key":"nicolas.dudebout@gmail.com","avatar":"https://gravatar.com/avatar/40b08a1cb5f41df9ef4a35e658a60d8a81697cdc07c88d352428c92f20c2d452?d=mp&s=160"},"body":"Hi,\n\nI was looking at the coloring of git branches in the output of\ndifferent commands and had an idea.\nIt seems to me that the color coding for branches should be uniform throughout.\n\nIt would for example be nice to be able to set current branch to be\nyellow and have it be yellow in:\na) git branch -a\nb) git log --decorate\nc) git status\nd) git status --short --branch\ne) git checkout\n(this list is most likely not exhaustive)\n\nAs of now, you need to set the color of the current branch for each\nindividual command.\nHere are the options you need to set:\na) color.branch.current\nb) color.decorate.branch\nc) color.status.branch\nd) It is impossible to change the color (hard coded to green)\ne) It is not colored\n\nI think the problems posed by this approach are clear:\n- inconsistent coloring for the same object in different commands: a),\nb), c), d), e)\n- inconsistent coloring for the same object in the same command with\ndifferent options: c), d)\n- inconsistent naming for the same object in different commands:\ncurrent in a), branch in b)\n- impossibility to color some objects: d), e)\n\nI have identified ways to address some of these problems:\n\n[1] git status\nAs the examples c) and d) show there is an inconsistency between the\nshort and the default version of the command. There are two colors\ndefined for the same element, namely WT_STATUS_LOCAL_BRANCH for the\nshort version and WT_STATUS_ONBRANCH for the default version. One\nversion should be picked and used in both instances. As this is done,\nit would be good to also give the opportunity to chose the color of\nthe remote branch.\n<<This problem [1] is what I was trying to solve when I submitted a\npatch last night:\nhttp://article.gmane.org/gmane.comp.version-control.git/185563>>\n\n[2] format_tracking_info(branch, &sb)\nThe function format_tracking_info defined in remote.c is used in only\ntwo other files wt-status.c and builtin/checkout.c. It does not color\nthe remote branches, the ahead or behind number (git status -sb to\ndoes the full coloring). It would be nice to have these colored.\n\n[3] color naming\nIt would be nice to unify the naming of the colors meaning the same\nthing. I could see using:\n- current: for the current checked-out branch\n- local: for other local branches\n- remote: for remote branches\n\n[4] single option for a type of branch\nIt would be really useful to create a unique option\nconfig.color.branches.<slot> with <slot> in {current, local, remote}.\nThis option could also be overwritten by specific command options such\nas color.status.current.\n\n[1] can easily be done, once a color name has been decided\n[2] could be a little trickier since it is shared code between status\nand checkout (might need to solve [4] first)\n[3] should be easy but would create some compatibility issues\n[4] I do not know how easy it would be to implement. If git is\nstructured the way it is right now, there is probably a good reason\nfor it.\n\nWhat are your thoughts on that?\n\nNicolas\n"},{"id":"180138","messageId":"20111130065540.GD5317@sigill.intra.peff.net","threadId":"28963","inReplyTo":"CA+TMmK=476h1YyVcegWia2F+1bhOQyNLf-150qF1bnU8Wu3qJA@mail.gmail.com","subject":"Re: Uniform branch coloring","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-11-30T06:55:40Z","receivedAt":"2011-11-30T06:55:40Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Nov 17, 2011 at 02:08:38PM -0500, Nicolas Dudebout wrote:\n\n> I was looking at the coloring of git branches in the output of\n> different commands and had an idea.\n> It seems to me that the color coding for branches should be uniform throughout.\n\nThat sounds like a reasonable goal. At the very least all of the spots\nshould be configurable, so you can make it uniform if you want to.\n\nAnd then having unset config fallback to a \"master\" switch (e.g., if\ncolor.branch.current is unset, use color.default.branch or whatever).\nWhich I think is close to what you write below.\n\n> I have identified ways to address some of these problems:\n> [...]\n\nThese all looked like reasonable goals to me. You will have to do a\nlittle refactoring, I'm sure.\n\n> What are your thoughts on that?\n\nGo for it. Your ideas sound sane. You might hit some ugly complexities\nin the implementation, but you won't know until you dig in and try. And\npatches are much easier to review (and apply!) than ideas. :)\n\n-Peff\n"}]}