From 02a5ae2adc2df39fc78fd7e29904ff473e9266a0 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 24 Jun 2026 10:19:30 +0200 Subject: feat: repo delete - remove repo, move bare repo to trash gitctl repo delete removes a repo from all three places it lives, the inverse of repo create: - gitolite stanza via remove_stanza (inverse of add_stanza), committed and pushed FIRST so gitolite stops serving the repo before its bytes move. - cgit block via the new delete-repo helper verb (remove_repo_block, inverse of insert_repo_block), backed up and synced. - the bare repo is MOVED to TRASH_DIR (/var/lib/gitolite3/trash, timestamped) with a .trashinfo breadcrumb, not rm, so it is recoverable. A realpath check keeps the move one level under REPO_BASE. Always confirms; the global -y is deliberately not honored (cmd_delete never reads a.yes). Idempotent: a piece already gone is skipped. Partial failure is resumable by re-running, like create. Both inverse functions are pinned by add/insert-then-remove round-trip self-tests plus middle/last/missing cases; trash_repo and do_delete_repo run on temp dirs. Verified live: create then delete round-trips against the real gitolite.conf, bare repo lands in the trash dir intact. Helper changed: redeploy gitctl-helper to the server. Co-Authored-By: Claude Opus 4.8 --- skills/gitctl/SKILL.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'skills') diff --git a/skills/gitctl/SKILL.md b/skills/gitctl/SKILL.md index 8660669..a37c1f7 100644 --- a/skills/gitctl/SKILL.md +++ b/skills/gitctl/SKILL.md @@ -17,6 +17,7 @@ setup" and "Client install") rather than guessing. ## When to use - User wants a NEW repo on the server -> `gitctl repo create` +- DELETE a repo from the server -> `gitctl repo delete` (destructive, always confirms) - List every repo (public AND private) -> `gitctl repo list` - List/add cgit sections (categories) -> `gitctl sections list|add` - Set a repo's cgit description -> `gitctl repo desc` @@ -60,8 +61,13 @@ git push -u origin master `gitctl repo create` command. It is idempotent: it detects the existing stanza, skips phase 1, and finishes phase 2. Do not start over. - **Section names with spaces must be quoted**: `--section "My Sites"`. -- **No delete verb.** Removing a repo/section is deliberately manual (server - side). Do not script deletion through gitctl. +- **`repo delete ` is destructive and ALWAYS confirms** (the global `-y` + does not bypass it, by design). It removes the gitolite stanza (commit + push, + so it needs the SSH key like create), removes the cgit block, and MOVES the + bare repo to the server trash dir (`/var/lib/gitolite3/trash`, timestamped) - + it does not `rm`, so it is recoverable there. Idempotent: a piece already gone + is skipped. There is still no delete verb for SECTIONS; removing a section is + manual. - **`--desc` is the only way to set a cgit description.** It writes the bare repo's `description` file and runs the sync script (the single writer of `repo.desc=`). Never write `repo.desc=` directly. -- cgit v1.2.3