From 5ac3d9aee092a1d061d1635a117feaefd4464333 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 6 Jun 2025 00:34:42 +0200 Subject: [PATCH] allow index symlinks to change --- src/apply_indexchanges.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/apply_indexchanges.rs b/src/apply_indexchanges.rs index eb49c60..af724fe 100755 --- a/src/apply_indexchanges.rs +++ b/src/apply_indexchanges.rs @@ -203,12 +203,12 @@ pub fn apply_indexchanges_int( if let Err(e) = std::env::set_current_dir(&p) { eprintln!("\n[warn] couldn't cd to {p:?}: {e}"); } else { - if let Err(e) = std::os::unix::fs::symlink( - link_target, - index_file - .file_name() - .expect("a file should always have a filename"), - ) { + let index_file_name = index_file + .file_name() + .expect("a file should always have a filename"); + let _ = std::fs::remove_file(&index_file_name); + if let Err(e) = std::os::unix::fs::symlink(link_target, index_file_name) + { eprintln!( "\n[warn] couldn't set index file {index_file:?} to be a symlink to {link_target:?}: {e}" );