mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Demonstrate that a lock error in a streamed command isn't retried
The gpg helper runs commands like amend with StreamOutput, so their output isn't captured and a failed run returns an empty output string; the index.lock message is carried by the error instead. isRetryableError only inspects the output, so the retry loop never fires for these commands. In practice this means a `shift-A` amend issued while a foreground `git status` refresh briefly holds index.lock fails outright instead of retrying. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e90daaf812
commit
0902c5c058
|
|
@ -90,3 +90,22 @@ func TestRunWithOutputRetriesWhenLockErrorIsInOutput(t *testing.T) {
|
|||
assert.Equal(t, "done", output)
|
||||
assert.Equal(t, 2, inner.calls)
|
||||
}
|
||||
|
||||
func TestRunWithOutputRetriesWhenLockErrorIsOnlyInError(t *testing.T) {
|
||||
// A streamed command (e.g. an amend run through the gpg helper) doesn't
|
||||
// capture its output, so a lock failure surfaces only in the returned error
|
||||
// with an empty output string. The retry logic must still recognize it.
|
||||
inner := &scriptedRunner{results: []runnerResult{
|
||||
{output: "", err: errors.New("fatal: Unable to create '/repo/.git/index.lock': File exists.")},
|
||||
{output: "", err: nil},
|
||||
}}
|
||||
|
||||
_, err := newTestRunner(inner).RunWithOutput(dummyCmdObj())
|
||||
|
||||
/* EXPECTED:
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 2, inner.calls)
|
||||
ACTUAL: */
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, 1, inner.calls)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue