Add Git version to logs
This commit is contained in:
parent
5ff930300f
commit
65b2b4b3b6
|
@ -19,14 +19,22 @@ namespace SparkleLib.Git {
|
|||
|
||||
public class SparkleGit : SparkleProcess {
|
||||
|
||||
public static string ExecPath;
|
||||
public static string GitPath;
|
||||
public static string SSHPath;
|
||||
public static string GitPath;
|
||||
public static string ExecPath;
|
||||
|
||||
|
||||
public static string GitVersion {
|
||||
get {
|
||||
string git_version = new SparkleProcess (GitPath, "--version").StartAndReadStandardOutput ();
|
||||
return git_version.Replace ("git version ", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SparkleGit (string path, string args) : base (path, args)
|
||||
{
|
||||
if (string.IsNullOrEmpty (GitPath))
|
||||
if (GitPath == null)
|
||||
GitPath = LocateCommand ("git");
|
||||
|
||||
StartInfo.FileName = GitPath;
|
||||
|
@ -41,7 +49,7 @@ namespace SparkleLib.Git {
|
|||
"-o PasswordAuthentication=no " +
|
||||
"-F /dev/null"; // Ignore the environment's SSH config file
|
||||
|
||||
if (!string.IsNullOrEmpty (ExecPath))
|
||||
if (ExecPath == null)
|
||||
SetEnvironmentVariable ("GIT_EXEC_PATH", ExecPath);
|
||||
|
||||
SetEnvironmentVariable ("GIT_SSH_COMMAND", GIT_SSH_COMMAND);
|
||||
|
|
|
@ -23,7 +23,18 @@ namespace SparkleLib {
|
|||
|
||||
public class SparkleProcess : Process {
|
||||
|
||||
public SparkleProcess (string path, string args) {
|
||||
bool write_output;
|
||||
|
||||
|
||||
public SparkleProcess (string path, string args) : this (path, args, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public SparkleProcess (string path, string args, bool write_output)
|
||||
{
|
||||
this.write_output = write_output;
|
||||
|
||||
StartInfo.FileName = path;
|
||||
StartInfo.Arguments = args;
|
||||
StartInfo.UseShellExecute = false;
|
||||
|
@ -41,6 +52,7 @@ namespace SparkleLib {
|
|||
if (!string.IsNullOrEmpty (StartInfo.WorkingDirectory))
|
||||
folder = Path.GetFileName (StartInfo.WorkingDirectory) + " | ";
|
||||
|
||||
if (this.write_output)
|
||||
SparkleLogger.LogInfo ("Cmd", folder + Path.GetFileName (StartInfo.FileName) + " " + StartInfo.Arguments);
|
||||
|
||||
try {
|
||||
|
|
|
@ -25,6 +25,7 @@ using MonoMac.Foundation;
|
|||
using MonoMac.AppKit;
|
||||
|
||||
using SparkleLib;
|
||||
using SparkleLib.Git;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
|
@ -41,9 +42,8 @@ namespace SparkleShare {
|
|||
{
|
||||
NSApplication.Init ();
|
||||
|
||||
// Let's use the bundled git first
|
||||
SparkleLib.Git.SparkleGit.GitPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core", "git");
|
||||
SparkleLib.Git.SparkleGit.ExecPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core");
|
||||
SparkleGit.GitPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core", "git");
|
||||
SparkleGit.ExecPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
|
||||
using SparkleLib;
|
||||
using SparkleLib.Git;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
|
@ -211,9 +212,9 @@ namespace SparkleShare {
|
|||
|
||||
public virtual void Initialize ()
|
||||
{
|
||||
SparkleLogger.LogInfo ("Environment", SparkleLib.SparkleBackend.Platform + " (" + Environment.OSVersion + ")");
|
||||
// TODO: SparkleLogger.LogInfo ("Environment", "Git version: ");
|
||||
SparkleLogger.LogInfo ("Environment", "SparkleShare " + SparkleLib.SparkleBackend.Version);
|
||||
SparkleLogger.LogInfo ("Environment", "SparkleShare " + SparkleBackend.Version);
|
||||
SparkleLogger.LogInfo ("Environment", "Git " + SparkleGit.GitVersion);
|
||||
SparkleLogger.LogInfo ("Environment", SparkleBackend.Platform + " (" + Environment.OSVersion + ")");
|
||||
|
||||
SparklePlugin.PluginsPath = PluginsPath;
|
||||
InstallProtocolHandler ();
|
||||
|
|
Loading…
Reference in a new issue