rbong / vim-flog

A blazingly fast, stunningly beautiful, exceptionally powerful git branch viewer for Vim/Neovim.
750 stars 22 forks source link

Match remotes to branch prefixes GetCommitRefs() #126

Closed TamaMcGlinn closed 3 months ago

TamaMcGlinn commented 3 months ago

This fixes #124 by checking when retrieving commitrefs which of the prefixes actually match with the output of git remote -v

I don't think this can be done more efficiently with caching, as we can't guarantee remotes have been added/removed between calls. However, maybe it would be enough to do this every time we redraw the graph.

rbong commented 3 months ago

I ended up having time to work on this.

It turns out that remotes with slashes are also possible. So I had to add some logic to handle this.

This means some refs are ambiguous... is a/b/c from origin a/b with branch c? Or is it from origin a with branch b/c? I didn't see any git log options which could help to disambiguate ref names. For now I'm just matching refs in the order they appear with git remote -v.