From 3f73e56fd32bb557899cf07d1eaa615f15164cd0 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 11 Nov 2026 19:06:25 +0100 Subject: [PATCH] Ignore SIGHUP in the index.lock test hook before forking sync/lock_error_partway_through_pull_with_rebase failed on CI: every attempt to continue the rebase ran into index.lock, as if the lock was never released. The test hook that holds index.lock starts a background process that removes the lock once the git command that ran the hook has exited. If lazygit runs the command in a pty, as it does for a pull, the command's exit sends SIGHUP to that process. The process ignored SIGHUP, but only once it got to run. On a busy machine the command can exit before that; SIGHUP then kills the process and leaves the lock behind. Delaying the start of the process by 0.3s makes the test fail every time. Ignore SIGHUP in the hook before starting the background process, so that the process inherits it. With this, the test passes even with the delay. Co-Authored-By: Claude Opus 5.5 --- pkg/integration/tests/shared/index_lock.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/integration/tests/shared/index_lock.go b/pkg/integration/tests/shared/index_lock.go index 5d2caf12a..4384ea6a0 100644 --- a/pkg/integration/tests/shared/index_lock.go +++ b/pkg/integration/tests/shared/index_lock.go @@ -11,10 +11,12 @@ import ( // of several steps, such as a rebase, is partway through. const holdIndexLockScript = `if [ ! -e .git/index-lock-taken ]; then touch .git/index-lock-taken .git/index.lock + # If lazygit runs the command in a pty (as it does for a pull), the + # background process below gets SIGHUP when the command exits. This can + # happen before the process has run its first command, so ignore SIGHUP + # before starting it; it inherits this. + trap '' HUP ( - # If lazygit runs the command in a pty (as it does for a pull), we - # get SIGHUP when the command exits - trap '' HUP while kill -0 $PPID 2>/dev/null; do sleep 0.01; done rm -f .git/index.lock ) >/dev/null 2>&1