From ecd84c6b878c379a581d7b53f1129722fadfa482 Mon Sep 17 00:00:00 2001 From: Markus Stoll Date: Thu, 4 Feb 2021 15:02:30 +0100 Subject: [PATCH] GIT Repostory, dealing with git modules - avoid File conflict on renaming HEAD file --- Sparkles/Git/Git.Repository.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sparkles/Git/Git.Repository.cs b/Sparkles/Git/Git.Repository.cs index dbebaa6d..3d0433cc 100644 --- a/Sparkles/Git/Git.Repository.cs +++ b/Sparkles/Git/Git.Repository.cs @@ -934,7 +934,12 @@ namespace Sparkles.Git { string HEAD_file_path = Path.Combine (child_path, "HEAD"); if (File.Exists (HEAD_file_path)) { - File.Move (HEAD_file_path, HEAD_file_path + ".backup"); + string HEAD_file_path_backup = Path.Combine (child_path, "HEAD.backup"); + if (File.Exists (HEAD_file_path_backup)) { + File.Delete (HEAD_file_path_backup); + } + + File.Move (HEAD_file_path, HEAD_file_path_backup); Logger.LogInfo ("Git", Name + " | Renamed " + HEAD_file_path); }