Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazygit hangs after branch checkout command due to interactive git hook #3557

Open
med8bra opened this issue May 10, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@med8bra
Copy link

med8bra commented May 10, 2024

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
echo 'exec </dev/tty && read line || true' > .git/hooks/post-checkout
chmod u+x .git/hook/post-checkout
  1. Open lazygit, and go to 'Branches' pane
  2. Checkout branch
  3. 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, maybe it would make sense to give user access to stdin when a command is interactive as in edit command.

@med8bra med8bra added the bug Something isn't working label May 10, 2024
@canadaduane
Copy link

Just noticed this as well. We have a git hook that wants to request that a checklist is covered before pushing. The user is supposed to say "y" at tty when answering checklist items. We'd prefer to do it on the CLI rather than resort to adding the checklists as a Github extension.

exec < /dev/tty

while true; do
  read -p "[pre-push hook] Have you viewed the change or feature in-app before pushing? (Y/n) " yn
  if [ "$yn" = "" ]; then
    yn='Y'
  fi
  case $yn in
      [Yy] ) exit 0;; 
      [Nn] ) exit 1;;
      * ) echo "Please answer y or n for yes or no.";;
  esac
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants