List GitLFS version

This commit is contained in:
Hylke Bons 2016-05-29 20:12:20 -07:00 committed by Hylke Bons
parent fe01f96e17
commit 6e16361c8f
2 changed files with 41 additions and 8 deletions

View file

@ -215,9 +215,11 @@ namespace SparkleShare {
public virtual void Initialize ()
{
Logger.LogInfo ("Environment", "SparkleShare " + InstallationInfo.Version);
Logger.LogInfo ("Environment", "Git LFS " + Sparkles.Git.GitCommand.GitLFSVersion);
Logger.LogInfo ("Environment", "Git " + Sparkles.Git.GitCommand.GitVersion);
// TODO: ToString() with nice os version names (Mac OS X Yosemite, Fedora 24, Ubuntu 16.04, etc.)
Logger.LogInfo ("Environment", InstallationInfo.OperatingSystem + " (" + Environment.OSVersion + ")");
// todo tostring with nice os version names
Preset.PresetsPath = PresetsPath;
InstallProtocolHandler ();

View file

@ -25,6 +25,7 @@ namespace Sparkles.Git {
static string git_path;
static string git_lfs_path;
public static string GitPath {
get {
@ -39,6 +40,19 @@ namespace Sparkles.Git {
}
}
public static string GitLFSPath {
get {
if (git_lfs_path == null)
git_lfs_path = LocateCommand ("git-lfs");
return git_lfs_path;
}
set {
git_lfs_path = value;
}
}
public static string GitVersion {
get {
@ -50,6 +64,16 @@ namespace Sparkles.Git {
}
}
public static string GitLFSVersion {
get {
if (GitLFSPath == null)
GitLFSPath = LocateCommand ("git-lfs");
string git_lfs_version = new Command (GitLFSPath, "version").StartAndReadStandardOutput ();
return git_lfs_version.Replace ("git-lfs/", "").Split (' ') [0];
}
}
public GitCommand (string working_dir, string args) : this (working_dir, args, null)
{
@ -65,23 +89,30 @@ namespace Sparkles.Git {
string GIT_SSH_COMMAND = SSHPath;
if (auth_info != null) {
GIT_SSH_COMMAND = SSHPath + " " +
"-i \"" + auth_info.PrivateKeyFilePath + "\" " +
"-o UserKnownHostsFile=\"" + auth_info.KnownHostsFilePath + "\" " +
"-o PasswordAuthentication=no " +
"-F /dev/null"; // Ignore the environment's SSH config file
}
if (auth_info != null)
GIT_SSH_COMMAND = FormatGitSSHCommand (auth_info);
if (ExecPath == null)
SetEnvironmentVariable ("GIT_EXEC_PATH", ExecPath);
Console.WriteLine (GIT_SSH_COMMAND);
SetEnvironmentVariable ("GIT_SSH_COMMAND", GIT_SSH_COMMAND);
SetEnvironmentVariable ("GIT_TERMINAL_PROMPT", "0");
SetEnvironmentVariable ("LANG", "en_US");
}
public static string FormatGitSSHCommand (SSHAuthenticationInfo auth_info)
{
return SSHPath + " " +
"-i " + auth_info.PrivateKeyFilePath.Replace (" ", "\\ ") + " " +
"-o UserKnownHostsFile=" + auth_info.KnownHostsFilePath.Replace (" ", "\\ ") + " " +
"-o PasswordAuthentication=no " +
"-F /dev/null"; // Ignore the environment's SSH config file
}
void SetEnvironmentVariable (string variable, string content)
{
if (StartInfo.EnvironmentVariables.ContainsKey (variable))