Tuckr icon indicating copy to clipboard operation
Tuckr copied to clipboard

Handle file vs directory mismatches between source and target

Open rmbruntz opened this issue 4 weeks ago • 1 comments

In the case where the target path of a source file is taken by a directory, it is currently skipped in validate() due to

if target.is_dir() {
    continue;
}

This seems to only be intended to catch directory-directory cases, but catches file-directory cases as well. This causes groups where all files have a directory at their target path to be missing from tuckr status - neither on the "Symlinked" or "Not Symlinked" side, nor shown in the "Conflicting Dotfiles" list.

A similar issue exists in remove_files_and_decide_if_adopt(), where the type of removal function was chosen based on the target_file despite running the function on deleted_file (which differs from target_file in --adopt cases). If there is a mismatch between source and target type, this will call the wrong function in --adopt.

This change fixes these behaviors by limiting the continue to true directory-directory cases and basing the deletion function on the type of deleted_file instead.

rmbruntz avatar Nov 11 '25 03:11 rmbruntz

I'll test this out and merge it as soon as I have free time to poke around a bit. Thanks!

RaphGL avatar Nov 11 '25 10:11 RaphGL

I've tested your changes. Very nice catch :)

RaphGL avatar Nov 16 '25 11:11 RaphGL