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

FIX: Properly render HEAD with NeogitBranchHead highlight group #974

Merged
merged 2 commits into from
Nov 28, 2023

Conversation

gollth
Copy link
Contributor

@gollth gollth commented Nov 27, 2023

Sorry I just noticed, I introduced a small bug in my previous PR #934, where local checked out branches are not rendered with the NeogitBranchHead. With a user config of:

local blue = "#bae7ff"
local remote = "#b4eeb2"

vim.api.nvim_set_hl(0, "NeogitBranch", { fg = blue, bold = true })
vim.api.nvim_set_hl(0, "NeogitBranchHead", { fg = blue, bold = true, underline = true })
vim.api.nvim_set_hl(0, "NeogitRemote", { fg = remote, italic = true })

and a branch called foo checked out, this is what happens:

Before After
before after

This PR should fix this now =)

Copy link
Member

@CKolkey CKolkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, lets just remove the commented out line and we're good :)

lua/neogit/buffers/common.lua Outdated Show resolved Hide resolved
@gollth
Copy link
Contributor Author

gollth commented Nov 28, 2023

Dammit I noticed another bug, while retesting this...

Right now there is now way to display remote only branches. My impl will always highlight the last part of each branch with the NeogitBranch highlight group:

Before After
before after

Note in the example above, how github/master and gollth/master are both highlighted in green/blue indicating that my local master branch is both at github/master & gollth/master AT THE SAME TIME !?! Same goes with with the fix-head-log-graph being locally a commit further than its remote AND SIMULTANEOUSLY at its remote...

This should be fixed now as well, sorry for all the confusion @CKolkey. Git is hard... 🙈

@CKolkey
Copy link
Member

CKolkey commented Nov 28, 2023

Haha, no joke. The last 10~ months of working on this project have been a great deep-dive into so much of how git works under the hood, and I still feel like I know almost nothing. So many small details.

Previoulsy this highlighting failed for branches which didn't have a
remote. Instead of the local branch rendering with the
`NeogitBranchHead` highlight group, the next tracked branch would be
highlighted as HEAD instead.
@gollth
Copy link
Contributor Author

gollth commented Nov 28, 2023

I can imagine o.O This Torvalds dude is quite the smart guy

@CKolkey
Copy link
Member

CKolkey commented Nov 28, 2023

No joke. Once (linux) is good luck. Twice (git)... impressive. I watched a talk he gave at google in like... 2010 maybe, the very early days of git. Very interesting to see him explain the shortcomings of every other VCS available, things that I definitely take for granted like "easy branching" and "fully decentralised". Good stuff.

@CKolkey CKolkey merged commit 961a9af into NeogitOrg:master Nov 28, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants