From 3baf58b48b3ddf10bae4e00bacef063d220b1750 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 30 Oct 2017 09:53:16 -0400 Subject: [PATCH] Catches submodule update exception --- TGServerService/EventID.cs | 3 ++- TGServerService/ServerInstance/Repository.cs | 25 +++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/TGServerService/EventID.cs b/TGServerService/EventID.cs index 114173498d..02824101ab 100644 --- a/TGServerService/EventID.cs +++ b/TGServerService/EventID.cs @@ -276,8 +276,9 @@ namespace TGServerService IRCLogModes = 6500, /// /// Warning: When the Repository submodule handler has to reclone a submodule entirely. This is a long operation and is due to an upstream bug + /// Error: When a submodule update operation fails completely /// - SubmoduleReclone = 6600, + Submodule = 6600, /// /// This event is of type or . It occurs when a user different from the previous one tries and either succeeds or fails to access a . DreamDaemon itself successfully accessing will not trigger this /// diff --git a/TGServerService/ServerInstance/Repository.cs b/TGServerService/ServerInstance/Repository.cs index b58f9c31b1..0ebbddb121 100644 --- a/TGServerService/ServerInstance/Repository.cs +++ b/TGServerService/ServerInstance/Repository.cs @@ -637,20 +637,27 @@ namespace TGServerService } catch (Exception e) { - //workaround for https://github.com/libgit2/libgit2/issues/3820 - //kill off the modules/ folder in .git and try again try { - Program.DeleteDirectory(String.Format("{0}/.git/modules/{1}", RepoPath, I.Path)); + //workaround for https://github.com/libgit2/libgit2/issues/3820 + //kill off the modules/ folder in .git and try again + try + { + Program.DeleteDirectory(String.Format("{0}/.git/modules/{1}", RepoPath, I.Path)); + } + catch + { + throw e; + } + Repo.Submodules.Update(I.Name, suo); + var msg = String.Format("I had to reclone submodule {0}. If this is happening a lot find a better hack or fix https://github.com/libgit2/libgit2/issues/3820!", I.Name); + SendMessage(String.Format("REPO: {0}", msg), MessageType.DeveloperInfo); + Service.WriteWarning(msg, EventID.Submodule); } - catch + catch (Exception ex) { - throw e; + Service.WriteError(String.Format("Failed to update submodule {0}! Error: {1}", I.Name, ex.ToString()), EventID.Submodule); } - Repo.Submodules.Update(I.Name, suo); - var msg = String.Format("I had to reclone submodule {0}. If this is happening a lot find a better hack or fix https://github.com/libgit2/libgit2/issues/3820!", I.Name); - SendMessage(String.Format("REPO: {0}", msg), MessageType.DeveloperInfo); - Service.WriteWarning(msg, EventID.SubmoduleReclone); } }