Repository navigation
Conversation
When resolving a move cycle, the parent-into-itself check compared the destination against the source with a bare prefix match. Swapping the names of `foo` and `foo2` therefore looked like moving `foo` into itself and failed with "Detected cycle in desired paths". Only treat the destination as nested when it starts with the source followed by a path separator, as the check for selected actions already does. Fixes stevearc#754
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #754
Problem
When
enforce_action_orderfinds a move cycle, it first checks whether the move is a parent being moved into itself:That is a plain string prefix check, so for the swap in the issue (
foo->foo2andfoo2->foo) the movefoo->foo2is treated as "movingfoointo itself" and the whole save fails. Whether it happens depends on which of the two moves ends up asloop_action, which matches the reporter's note that it is not always reproducible.Change
Compare against
src_url .. "/", the same way the check for selected actions a few lines below already does (Cannot move or copy parent into itself). A real move of a directory into its own child (/a->/a/b) is still rejected, and the existing "Detects move directory loops" test still passes.Tests
Added
Resolves MOVE loops between names that share a prefixtotests/mutator_spec.lua. It runsenforce_action_orderon the two moves in both orders and expects the loop to be split into three moves: one file moved to a temporary name, the other moved into place, then the temporary moved to its destination. Without the change it fails withDetected cycle in desired paths, and with it./run_tests.shpasses.luacheck lua testsis clean andstylua --checkis clean on the changed files.Motivation / disclosure: I had some spare AI-assistant quota (Claude Code) and am using it to try to help projects with open issues. The change was prepared with Claude Code and verified as listed above. If it doesn't fit, isn't up to your bar, or you'd simply rather not take it, please feel free to close it, no hard feelings at all 🙂