isakbm / gitgraph.nvim

Git Graph plugin for neovim
MIT License
309 stars 7 forks source link

gitgraph.lua:987: assertion failed! #15

Closed kdheepak closed 3 months ago

kdheepak commented 3 months ago

Thanks for making this plugin!

I wanted to report that I get the following error when I try to clone https://github.com/ratatui-org/ratatui and run gitgraph:

E5108: Error executing lua: .../.local/share/nvim/lazy/gitgraph.nvim/lua/gitgraph.lua:987: assertion failed!
stack traceback:
        [C]: in function 'assert'
        .../.local/share/nvim/lazy/gitgraph.nvim/lua/gitgraph.lua:987: in function 'commit_cell_symb'
        .../.local/share/nvim/lazy/gitgraph.nvim/lua/gitgraph.lua:1012: in function 'row_to_str'
        .../.local/share/nvim/lazy/gitgraph.nvim/lua/gitgraph.lua:1150: in function 'gitgraph'
        .../.local/share/nvim/lazy/gitgraph.nvim/lua/gitgraph.lua:1851: in function 'draw'
        /Users/USERNAME/.config/nvim/lua/kd/plugins/git-graph.lua:29: in function </Users/USERNAME/.config/nvim/lua/kd/plugins/git-graph.lua:28>
Press ENTER or type command to continue
Xouzoura commented 3 months ago

Same here for me in ubuntu

isakbm commented 3 months ago

Thank you.

Will try to reproduce this and get to the bottom of it.

isakbm commented 3 months ago

Was able to reproduce this, btw that repo looks amazing :) <3 Rust

isakbm commented 3 months ago

This is an interesting bug, it seems related to a branch called (origin/images), ... gitgraph tries to render this branch, but perhaps this branch has no common ancestors with the other branches 🤔

...

isakbm commented 3 months ago

Oh cool, I think I figured out what it is.

Commit 6754f92 has no parents, so has no ancestors in common with the rest of the repo. I just never considered handling this case. I'll probably have a fix in today. BTW git log --graph --oneline --dateorder shows this, but git log --graph --oneline show something quite confusing.

image

image

So at least gitgraph is failing rather than trying to show something confusing like git log --graph does :)

Will be great to have this fixed though! 🎉

Diving deeper now

isakbm commented 3 months ago

Should now be fixed, please git it a try 🤞

Thanks again for reporting this, this is what makes open source so great!

kdheepak commented 3 months ago

Yay! Thanks for the quick fix! Works perfectly for me now!