From e75efe7b55376d050dc34fdaf39acf5505d200ae Mon Sep 17 00:00:00 2001 From: Nathan Gill Date: Thu, 25 Mar 2021 01:03:14 -0400 Subject: [PATCH] Fix for database updater commiting empty stuff, hopefully. --- DatabaseUpdater/Program.cs | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/DatabaseUpdater/Program.cs b/DatabaseUpdater/Program.cs index cc34c85..4a35833 100644 --- a/DatabaseUpdater/Program.cs +++ b/DatabaseUpdater/Program.cs @@ -96,28 +96,31 @@ private static void Main(string[] args) ConsoleLog(LogLevel.Info, $"Done fetching versions: {updated} updated, {error} errors, {alreadyUpToDate} already up to date."); - try + if (updated > 0) { - Commands.Stage(repo.Repo, "*"); - User user = GitHubClient.User.Current().GetAwaiter().GetResult(); - Signature sig = new(user.Name, user.Email, DateTimeOffset.Now); - repo.Repo.Commit($"Updated {updated} mods in database", sig, sig); + try + { + Commands.Stage(repo.Repo, "**/*"); + User user = GitHubClient.User.Current().GetAwaiter().GetResult(); + Signature sig = new(user.Name, user.Email, DateTimeOffset.Now); + repo.Repo.Commit($"Updated {updated} mods in database", sig, sig); - PushOptions options = new() - { - CredentialsProvider = (_, _, _) => - new UsernamePasswordCredentials {Username = user.Login, Password = args[0]} - }; - repo.Repo.Network.Push(repo.Repo.Head, options); + PushOptions options = new() + { + CredentialsProvider = (_, _, _) => + new UsernamePasswordCredentials {Username = user.Login, Password = args[0]} + }; + repo.Repo.Network.Push(repo.Repo.Head, options); - ConsoleLog(LogLevel.Info, "Pushed changes"); - } - catch (LibGit2SharpException e) - { - ConsoleLog(LogLevel.Error, "Couldn't push changes: " + e.Message); + ConsoleLog(LogLevel.Info, "Pushed changes"); + } + catch (LibGit2SharpException e) + { + ConsoleLog(LogLevel.Error, "Couldn't push changes: " + e.Message); + } } - + sw.Stop(); ConsoleLog(LogLevel.Info, $"Done in {sw.ElapsedMilliseconds / 1000d}s!"); }