jesseduffield / jesseduffield/lazygit

Lazygit hangs after branch checkout command due to interactive git hook

Open
#3,557 2 comments 7 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Describe the bug**
Lazygit hangs in `checking out` state when there is interactive `post-checkout` git hook

**To Reproduce**
Steps to reproduce the behavior:

1. Setup a git repository with an interactive post-checkout hook
```sh
echo 'exec .git/hooks/post-checkout
chmod u+x .git/hook/post-checkout
```
2. Open lazygit, and go to 'Branches' pane
3. Checkout branch
4. Lazygit hangs in 'Checking out' the branch

**Expected behavior**
Lazygit shouldn't hang on checkout, possible behaviors:
1. provide user control to interact with the git hook stdin.
2. terminate the git hook once checkout is done.

**Screenshots**
Status 'Checking out' doesn't change
image

**Version info:**
Lazygit: commit=, build date=, build source=nix, version=0.41.0, os=darwin, arch=arm64, git version=2.44.0

**Additional context**

I saw how you handle credential requests [sync.go#Pull](https://github.com/jesseduffield/lazygit/blob/618fe533f8c6113392eea981d03c65e6da5860bb/pkg/commands/git_commands/sync.go#L102), maybe it would make sense to give user access to stdin when a command is interactive as in edit command.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.