Uniform branch coloring

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I was looking at the coloring of git branches in the output of
different commands and had an idea.
It seems to me that the color coding for branches should be uniform throughout.

It would for example be nice to be able to set current branch to be
yellow and have it be yellow in:
a) git branch -a
b) git log --decorate
c) git status
d) git status --short --branch
e) git checkout
(this list is most likely not exhaustive)

As of now, you need to set the color of the current branch for each
individual command.
Here are the options you need to set:
a) color.branch.current
b) color.decorate.branch
c) color.status.branch
d) It is impossible to change the color (hard coded to green)
e) It is not colored

I think the problems posed by this approach are clear:
- inconsistent coloring for the same object in different commands: a),
b), c), d), e)
- inconsistent coloring for the same object in the same command with
different options: c), d)
- inconsistent naming for the same object in different commands:
current in a), branch in b)
- impossibility to color some objects: d), e)

I have identified ways to address some of these problems:

[1] git status
As the examples c) and d) show there is an inconsistency between the
short and the default version of the command. There are two colors
defined for the same element, namely WT_STATUS_LOCAL_BRANCH for the
short version and WT_STATUS_ONBRANCH for the default version. One
version should be picked and used in both instances. As this is done,
it would be good to also give the opportunity to chose the color of
the remote branch.
<<This problem [1] is what I was trying to solve when I submitted a
patch last night:
http://article.gmane.org/gmane.comp.version-control.git/185563>>

[2] format_tracking_info(branch, &sb)
The function format_tracking_info defined in remote.c is used in only
two other files wt-status.c and builtin/checkout.c. It does not color
the remote branches, the ahead or behind number (git status -sb to
does the full coloring). It would be nice to have these colored.

[3] color naming
It would be nice to unify the naming of the colors meaning the same
thing. I could see using:
- current: for the current checked-out branch
- local: for other local branches
- remote: for remote branches

[4] single option for a type of branch
It would be really useful to create a unique option
config.color.branches.<slot> with <slot> in {current, local, remote}.
This option could also be overwritten by specific command options such
as color.status.current.

[1] can easily be done, once a color name has been decided
[2] could be a little trickier since it is shared code between status
and checkout (might need to solve [4] first)
[3] should be easy but would create some compatibility issues
[4] I do not know how easy it would be to implement. If git is
structured the way it is right now, there is probably a good reason
for it.

What are your thoughts on that?

Nicolas
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]