NirmalScaria / le-git-graph

Browser extension to add git graph to GitHub website.
https://chrome.google.com/webstore/detail/le-git-graph-commits-grap/joggkdfebigddmaagckekihhfncdobff
MIT License
3.48k stars 18 forks source link

Branches in git graph are of same color (Red color with two concentric circles) #5

Closed thefirehacker closed 1 year ago

thefirehacker commented 1 year ago

Describe the bug Branches in git graph and legend on top right are all of same color. As a result its not possible to differentiate the branch in git graph and this impacts visualization.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://github.com/tensorflow/tensorflow'
  2. Ensure that the chrome extension is enabled and page is refreshed so that commit tab appears on github.
  3. Click on 'commits'
  4. See error

Expected behavior 3 Branch should have different color in legend (top right) and same color should be shown on git graph too.

Screenshots

Legend

GitGraph

Desktop (please complete the following information):

thefirehacker commented 1 year ago

This is an inconsistent issue , closing this issue now . Will reopen once its reproduced. I suspect that color for each branch is chosen at random and in some cases all colors are appearing red,

NirmalScaria commented 1 year ago

I was also able to reproduce the issue, in multiple repositories.

As of now, there are 9 colours defined for the branches/commits/legends. The problem is that these colours are not assigned in an optimal way. There is a strong bias towards red and blue.

Solving this issue will not only avoid the confusions, but provide a better visual experience too IMO.

thefirehacker commented 1 year ago

Great I will take a crack at fixing this issue too :) .

NirmalScaria commented 1 year ago

[UPDATE] I was able to find out what exactly goes wrong here. The algorithm to assign colours assigns colours in the order of, from newer commits to older commits. It keeps assigning the same colour as the child commit in most cases. And, a new colour is assigned only when either branching occurs, or when a child-less commit is found (which is rightly assumed to be the head of some branch). The problem with that approach is that, there could be commits which are head of some branch, but yet, not falling to either of the above categories. That results in two heads having same colour, and hence this issue. So, a new manual check should be implemented to check if the commit is the head of some branch, while assigning colours. That should fix this issue.

NirmalScaria commented 1 year ago

[UPDATE] This has been fixed. Along with improvements in the algorithm to assign colours... 😄