Catches submodule update exception

This commit is contained in:
Cyberboss
2017-10-30 09:53:16 -04:00
parent cf9ce2fac1
commit 3baf58b48b
2 changed files with 18 additions and 10 deletions
+2 -1
View File
@@ -276,8 +276,9 @@ namespace TGServerService
IRCLogModes = 6500,
/// <summary>
/// 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
/// </summary>
SubmoduleReclone = 6600,
Submodule = 6600,
/// <summary>
/// This event is of type <see cref="System.Diagnostics.EventLogEntryType.SuccessAudit"/> or <see cref="System.Diagnostics.EventLogEntryType.FailureAudit"/>. It occurs when a user different from the previous one tries and either succeeds or fails to access a <see cref="ServerInstance"/>. DreamDaemon itself successfully accessing <see cref="TGServiceInterface.Components.ITGInterop"/> will not trigger this
/// </summary>
+16 -9
View File
@@ -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);
}
}