Skip to content

Keep a plugin checkout's local work when removing it - #15680

Open
schmijos wants to merge 2 commits into
omacom:quattrofrom
schmijos:plugin-remove-keep-local-work
Open

schmijos wants to merge 2 commits into
omacom:quattrofrom
schmijos:plugin-remove-keep-local-work

Conversation

@schmijos

Copy link
Copy Markdown

omarchy plugin remove deleted any plugin folder that was a git checkout, on the grounds that "its git repo remains upstream". That isn't true when the checkout holds work of its own: uncommitted edits, untracked files, unpushed commits or stashes were deleted with rm -rf, while the prompt said nothing would be lost.

Now a checkout is deleted only if git confirms that everything in it is also upstream. Anything else goes through the existing backup path, which moves the folder to .<id>.bak.<timestamp>, the same as a hand-made folder. Because omarchy plugin update merges FETCH_HEAD without moving the remote-tracking refs, commits it brought in count as upstream. A checkout that has only been updated is still deleted.

The manual is updated to describe the new rule.

Testing

  • New test/shell.d/plugin-remove-test.sh: a clean checkout and a checkout updated from upstream are deleted; uncommitted, untracked, committed-but-unpushed and stashed work is backed up.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schmijos
schmijos marked this pull request as ready for review October 16, 2026 21:45
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous ignored-file deletion issue is fixed.

Summary

Plugin removal now backs up checkouts containing local work instead of deleting them.

  • Plugin removal keeps local checkout work in a timestamped backup.

No new issues found. Tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Remove plugin] --> B{Symlink?}
  B -->|Yes| C[Unlink]
  B -->|No| D{Git confirms nothing local?}
  D -->|Yes| E[Delete checkout]
  D -->|No or unknown| F[Move to timestamped backup]
Loading

Reviews (2) · Last reviewed commit: "Back up checkouts holding ignored files,..." · Reviewed by Greptile

Comment thread bin/omarchy-plugin-remove Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this. I read the diff, bin/omarchy-plugin-remove, bin/omarchy-plugin-update and the manual change, but this pull request has not been verified yet. Nothing ran on a worker and it carries no labels. Classifying it needs two models to agree, and the second one (Codex Medium) was unavailable this run because the day's review budget was spent. So the classification is unsettled, and verification waits until it is settled on a later pass.

One thing I did check, in a scratch repository and not with your code: Greptile is right that ignored files fall through. git status --porcelain --untracked-files=normal does not list files matched by .gitignore, so a checkout that is clean apart from an ignored file (a local secret.json listed in the plugin's own .gitignore, say) still counts as upstream-only and gets rm -rf'd. Adding --ignored to that git status call would send such a checkout to the backup path instead. The manual line would then want "ignored" next to "uncommitted or untracked".

Adding only the English manual chapter is correct. The translation sync workflow updates the other languages.

Next: this comes round again once the classification is settled. Then it gets a reproduction on a worker (fails on quattro, passes on this head), the suite and a second-opinion review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 21, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 60945c7, and it does what it says. The ignored-file case from the last review is fixed: --ignored is on the git status call, the manual names ignored files, and the test covers a .gitignored secret.json.

What ran, on a disposable worker built from the Omarchy ISO:

  • My own reproduction, separate from your test, put nine plugin checkouts through omarchy plugin remove. On quattro six of them lost local work outright: an uncommitted edit, an untracked file, an ignored file, an unpushed commit, a commit on another local branch, and a stash. On this head all six are moved to .<id>.bak.<timestamp> with the work intact. A clean clone, a clone updated by omarchy plugin update, and a clone pulled by hand are still deleted without a backup, as the manual says.
  • test/shell.d/plugin-remove-test.sh fails against the quattro copy of bin/omarchy-plugin-remove and passes on this head.
  • ./test/cli and every plugin shell test pass. i18n-test.sh fails on da/menu.json, and fails the same way on quattro, so it is not caused by this change.

The change is proportionate: one predicate in bin/omarchy-plugin-remove, one manual line, and a test. No other open pull request fixes this, though #11069, #15250, #15434 and #14966 also touch bin/omarchy-plugin-remove and may conflict, depending on the order they land in.

Second opinion: Codex Medium reviewed it in two rounds. In the first it listed cases the check does not catch: a commit reachable only from the reflog, hooks or config edited inside .git, branches or stashes inside a submodule, and a FETCH_HEAD written by hand with git fetch . HEAD. Its git behaviour is correct in each case. All of them need a deliberate git operation inside an installed plugin, and quattro deletes them today anyway, so I did not treat them as blockers. In the second round it agreed nothing is left to change. It had my reasoning in front of it, so that agreement is not independent.

Nothing is left for you to do. This now waits on the maintainer.

@omarchybot omarchybot removed the ready Good to merge label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants