Skip to content

Commit 7005d74

Browse files
committed
fixed #122: fixed group overlap resolving symlinks incorrectly
1 parent b63fa20 commit 7005d74

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/symlinks.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl<'a> SymlinkHandler<'a> {
399399
};
400400

401401
let mut removed_groups = HashSet::new();
402-
let mut added_files = Vec::new();
402+
let mut added_files = HashSet::new();
403403

404404
while let Some(idx) = dotfiles::get_highest_priority_target_idx(&groups) {
405405
let group = &groups[idx];
@@ -413,7 +413,7 @@ impl<'a> SymlinkHandler<'a> {
413413
if let Some(group) = dotfiles::get_group_from_target_path(&f_target) {
414414
removed_groups.insert(group);
415415
}
416-
added_files.push(f);
416+
added_files.insert(f);
417417
}
418418
} else {
419419
eprintln!(
@@ -429,24 +429,24 @@ impl<'a> SymlinkHandler<'a> {
429429

430430
// NOTE/TODO?: this will only work if the dotfiles are in the same profile context
431431
// maybe we should instead move the files into a temporary and then move them back
432-
for group in removed_groups {
432+
for group in &removed_groups {
433433
self.remove(dry_run, &group.group_name);
434434

435435
let target_path = group.to_target_path().unwrap();
436-
fs::create_dir_all(if target_path.is_file() {
436+
fs::create_dir_all(if group.path.is_file() {
437437
target_path.parent().unwrap()
438438
} else {
439439
&target_path
440440
})
441441
.unwrap();
442442

443-
let group_iter = Dotfile::try_from(group.group_path)
443+
let group_iter = Dotfile::try_from(group.group_path.clone())
444444
.unwrap()
445445
.try_iter()
446446
.unwrap();
447447

448448
for file in group_iter {
449-
added_files.push(file);
449+
added_files.insert(file);
450450
}
451451
}
452452

0 commit comments

Comments
 (0)