Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
Fix for database updater commiting empty stuff, hopefully.
Browse files Browse the repository at this point in the history
  • Loading branch information
nrgill28 committed Mar 25, 2021
1 parent 6510d12 commit e75efe7
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions DatabaseUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
Expand Down

0 comments on commit e75efe7

Please sign in to comment.