Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color branches by pattern #4118

Open
castlele opened this issue Dec 16, 2024 · 4 comments
Open

Color branches by pattern #4118

castlele opened this issue Dec 16, 2024 · 4 comments

Comments

@castlele
Copy link

Topic
On my work we name branches with the following pattern: <jira board name>-<jira ticket number>-<branch name>. For example:

IDS-1000-new-fancy-feature
ADE-2000-some-non-fancy-fix

To visualize the difference between different board types I want to be able to set colors of branches in lazygit's config by some pattern. For example:

gui:
    branchColors:
        'IDS*': '#28d1f7'
        'ADE*': '#39f728'

Right now this config won't work for me, because it searches for IDS/<branch name> and ADE/<branch name> patterns in this case.

Your thoughts

I've implemented a dummy solution for my problem that can be seen here. Unfortunately, as you can see this will broke current logic of coloring. So, if lazygit's team is interested in this change, I would like to contribute. And in this case I need help with splitting logic for coloring of prefixes and patterns

@stefanhaller
Copy link
Collaborator

This topic came up somewhere else a while ago, let me see... here: #3680 (reply in thread)

I think the solution would be to change these to be regular expressions. But yes, that would be a breaking change, so maybe it could become a new config (e.g. branchColorPatterns) which would override the other one if both are set, and then at some point we'd deprecate the old one. Or something like that.

@castlele
Copy link
Author

Ok, I will try to implement that. Thank you for your answer

@mtrajano
Copy link

I gave this one a go, let me know if there's any improvements I can make on it: #4130

@castlele
Copy link
Author

Hello!
I've implemented this the way we discussed with @stefanhaller here. Recently, I'm pretty busy, so no time to have a proper PR. So, maybe my work will be useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants