madt_clone: on "directory already exists", report whether it's the same repo or a different one #350

Closed
opened 2026-07-22 20:23:22 +00:00 by hexajon · 0 comments
hexajon commented 2026-07-22 20:23:22 +00:00 (Migrated from codeberg.org)

When madt_clone hits an existing target directory it stops with a bare "directory already exists". That leaves me to work out by hand whether the directory is a stale clone of the repo I actually asked for (safe to reuse) or an unrelated project that happens to share the name (a real collision I have to rename around).

The refusal already has what it needs to answer that - it can read the existing directory's origin remote and compare it against the repo being cloned.

Proposed behaviour when the target directory already exists:

  • origin matches the requested repo -> say so, and suggest reusing it or passing a fresh --directory
  • origin differs -> report both (existing origin vs requested) so the name collision is obvious at a glance
  • not a git repo at all -> say that instead

Turns a bare stop into a one-line diagnosis. Small quality-of-life thing, but it bit me today.

When `madt_clone` hits an existing target directory it stops with a bare "directory already exists". That leaves me to work out by hand whether the directory is a stale clone of the repo I actually asked for (safe to reuse) or an unrelated project that happens to share the name (a real collision I have to rename around). The refusal already has what it needs to answer that - it can read the existing directory's `origin` remote and compare it against the repo being cloned. Proposed behaviour when the target directory already exists: - origin matches the requested repo -> say so, and suggest reusing it or passing a fresh `--directory` - origin differs -> report both (existing origin vs requested) so the name collision is obvious at a glance - not a git repo at all -> say that instead Turns a bare stop into a one-line diagnosis. Small quality-of-life thing, but it bit me today.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#350
No description provided.