jesseduffield / lazygit

simple terminal UI for git commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Editing a gpg signed commit message via a Editor crashes

chmouel opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.

When editing a GPG signed commit, and doing C-o e to Open in Editor lazygit crash

2024/04/11 08:53:21 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*errors.errorString Feature not available for users using GPG
github.com/jesseduffield/lazygit/pkg/commands/git_commands/rebase.go:357 (0x1054c2084)
github.com/jesseduffield/lazygit/pkg/gui/controllers/local_commits_controller.go:379 (0x1055fce68)
github.com/jesseduffield/lazygit/pkg/gui/context/commit_message_context.go:134 (0x105599ce4)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/commits_helper.go:108 (0x105599cad)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/commits_helper.go:228 (0x10559a840)
github.com/jesseduffield/lazygit/pkg/gui/context/menu_context.go:169 (0x10550c388)
github.com/jesseduffield/lazygit/pkg/gui/controllers/menu_controller.go:73 (0x105606a30)
github.com/jesseduffield/lazygit/pkg/gui/controllers/list_controller_trait.go:112 (0x105606408)
github.com/jesseduffield/lazygit/pkg/gui/keybindings.go:445 (0x1056614d8)
github.com/jesseduffield/lazygit/pkg/gui/keybindings.go:398 (0x105661184)
github.com/jesseduffield/lazygit/pkg/gui/keybindings.go:392 (0x105661074)
github.com/jesseduffield/gocui@v0.3.1-0.20240309085756-86e0d5a312de/gui.go:1456 (0x1052c0bd0)
github.com/jesseduffield/gocui@v0.3.1-0.20240309085756-86e0d5a312de/gui.go:1424 (0x1052c0a80)
github.com/jesseduffield/gocui@v0.3.1-0.20240309085756-86e0d5a312de/gui.go:1281 (0x1052c0088)
github.com/jesseduffield/gocui@v0.3.1-0.20240309085756-86e0d5a312de/gui.go:800 (0x1052be754)
github.com/jesseduffield/gocui@v0.3.1-0.20240309085756-86e0d5a312de/gui.go:754 (0x1052be3a8)
github.com/jesseduffield/gocui@v0.3.1-0.20240309085756-86e0d5a312de/gui.go:741 (0x1052be14c)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:705 (0x10565993c)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:711 (0x105659ec0)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:117 (0x1053711a0)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:710 (0x105659e2c)
github.com/jesseduffield/lazygit/pkg/app/app.go:266 (0x105683d5c)
github.com/jesseduffield/lazygit/pkg/app/app.go:49 (0x105683d21)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:150 (0x10568595c)
github.com/jesseduffield/lazygit/main.go:23 (0x105687398)
runtime/internal/atomic/types.go:194 (0x104fe514c)
runtime/asm_arm64.s:1222 (0x10501a244)

To Reproduce
Steps to reproduce the behavior:

  1. Edit a GPG signed commit
  2. Do C-o
  3. Do e
  4. see the crash

Expected behavior
not crashing

Screenshots
If applicable, add screenshots to help explain your problem.

Version info:

commit=, build date=, build source=homebrew, version=0.41.0, os=darwin, arch=arm64, git version=2.44.0

Additional context
Add any other context about the problem here.

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

What happens here is that the <c-o> handler tries to throw the error "Feature not available for users using GPG", but nobody catches it, and so it bubbles up all the way into gocui, which panics seeing the error.

Which means that there are two potential solutions to this bug:

  1. Make it actually work
  2. Make it show the error message that the command is not supported, without crashing

The first of these is tricky and requires more work (see here; I'm not really sure I understand that comment though...).

The second is much easier, all it takes is a call to c.Error(err) at the appropriate point in the call chain. A good place might be in MenuController.press(). However, an even better fix would be to do #3491, this would solve it once and for all everywhere.