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!"); }