From 20ffe633679c1499de157d25c018d8b86540cf0f Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 9 Nov 2026 14:40:19 +1100 Subject: [PATCH] fix(worktree): object-not-found match tolerates a successful push --- internal/worktree/worktree.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/worktree/worktree.go b/internal/worktree/worktree.go index 220ff7f04..d06756d6e 100644 --- a/internal/worktree/worktree.go +++ b/internal/worktree/worktree.go @@ -717,7 +717,7 @@ func (m *Manager) push(ctx context.Context, dir, branch, remoteURL string) error }) } err = publish() - if errors.Is(err, plumbing.ErrObjectNotFound) || strings.Contains(err.Error(), plumbing.ErrObjectNotFound.Error()) { + if errors.Is(err, plumbing.ErrObjectNotFound) || err != nil && strings.Contains(err.Error(), plumbing.ErrObjectNotFound.Error()) { // The clone borrows objects from the shared mirror; a damaged mirror // loses them. The forge still has every base object, so rebuild it. m.logger().WarnContext(ctx, "push hit a missing object, rebuilding the mirror", "branch", branch, "err", err)