lazygit
lazygit copied to clipboard
lazygit fails to understand rebase editor text when git.core.commentChar is set to ;
I have commentChar set to ;
because #
interferes with markdown formatting. This breaks all editor-based interactive operations in lazygit.
To Reproduce
-
git config --global core.commentChar ";"
-
lazygit
a git repo and try to move a commit up or down, or delete one. - Operation fails with error:
2023/05/05 09:06:20 failed to parse line "; Rebase 4169408..31a7ac7 onto 4169408 (4 comma
nds)": unexpected command
error: There was a problem with the editor '"/opt/homebrew/bin/lazygit"'.
Verified operation works ok if I remove commentChar from git config.
Expected behavior
Lazygit reads commentChar from git config and adjusts it's operation appropriately.
Version info:
commit=, build date=, build source=homebrew, version=0.38.2, os=darwin, arch=arm64, git version=2.39.2 (Apple Git-143)
git version 2.39.2 (Apple Git-143)
Interesting, I didn't know you could do that. That's a deficiency in the git-todo-parser package, it hard-codes the comment character to #
. We'll have to change the API to allow passing in a different one (I don't think it's the git-todo-parser's responsibility to query the git config).
Or we could just pass -c core.commentChar=#
in the git rebase calls we make, that's even easier. Since we never present the git-rebase-todo file to the user, this shouldn't be a problem. (Only when people press "edit" on a commit and then type : git rebase --edit-todo
will they see the "wrong" comment character.)
This should be a good first issue; @niv, if you feel like tackling this yourself, there are two git rebase --interactive
calls in rebase.go
that need to be changed.
This issue is a regression, since lazygit 0.37.0 and earlier versions work fine with a custom commentChar. I am forced to use version 0.37.0 until the bug is fixed.
Fixed by #2639.