fix(repo): abort clone cleanly when the cluster picker is cancelled · Entire

fix(repo): abort clone cleanly when the cluster picker is cancelled

25cb1b8·

toothbrush·3w ago·1 file·+9 added/-2 removed

Ctrl+C in the multi-cluster picker returned a zero-value mirror with a nil error, so clone fell through to git clone entire:///gh/... (empty host). Treat a cancelled picker as a silent abort.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

2896bbc87616View transcript

Changes

1

200 unmodified lines

201
202
203
204
204
205
206
207
208
209
210
211
212
213
214
208
215
216
217
218

200 unmodified lines

),
    )
    if err := form.RunWithContext(cmd.Context()); err != nil {
        return coreapi.Mirror{}, handleFormCancellation(cmd.ErrOrStderr(), "Clone", err)
        // handleFormCancellation prints "Clone cancelled." and returns nil for a
        // Ctrl+C / cancelled-context abort. Surface that as a SilentError so the
        // caller stops instead of falling through to clone a zero-value target
        // (the `entire:///gh/...` empty-host bug); a real form error propagates.
        if cerr := handleFormCancellation(cmd.ErrOrStderr(), "Clone", err); cerr != nil {
            return coreapi.Mirror{}, cerr
        }
        return coreapi.Mirror{}, NewSilentError(errors.New("clone cancelled"))
    }
    m, ok := byHost[selected]
    if !ok {
        return coreapi.Mirror{}, errors.New("no cluster selected")
        return coreapi.Mirror{}, NewSilentError(errors.New("clone cancelled"))
    }
    return m, nil
}