Skip to content

Prevent Deletion When Source and Destination Are the Same#10

Merged
punkscience merged 1 commit into
mainfrom
fix-prevent-self-move-deletion
Nov 1, 2025
Merged

Prevent Deletion When Source and Destination Are the Same#10
punkscience merged 1 commit into
mainfrom
fix-prevent-self-move-deletion

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

This change prevents the music organizer from deleting files that are already correctly organized. When a file is moved to the same location, it will now be skipped instead of being deleted.


PR created automatically by Jules for task 524867552295453427

… same

Adds a check to prevent the deletion of a file when its source and
destination paths are identical. This can occur when the music organizer
is run on an already organized library.

The fix introduces the following changes:

- A new error, `ErrFileAlreadyExists`, is returned when the destination
  file already exists or when the source and destination paths are the
  same.
- The `CopyMusic` function now checks if the destination file exists or
  if the source and destination paths are the same.
- The `MoveMusic` function now checks for `ErrFileAlreadyExists` and
  skips the deletion of the source file if it is returned.
- The `cmd/copy` command now handles `ErrFileAlreadyExists` as a
  non-fatal error.
- A new test case has been added to verify that a file is not deleted
  when it is moved to the same location.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

@punkscience
punkscience marked this pull request as ready for review November 1, 2025 17:59
@punkscience
punkscience merged commit e3b3086 into main Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant