[repo] don't rely on Git# for username, email and remote url
This commit is contained in:
parent
8a93f69892
commit
97f419666d
|
@ -138,12 +138,12 @@ namespace SparkleLib {
|
||||||
LocalPath = path;
|
LocalPath = path;
|
||||||
Name = Path.GetFileName (LocalPath);
|
Name = Path.GetFileName (LocalPath);
|
||||||
|
|
||||||
RemoteOriginUrl = Config ["remote.origin.url"];
|
RemoteOriginUrl = GetRemoteOriginUrl ();
|
||||||
RemoteName = Path.GetFileNameWithoutExtension (RemoteOriginUrl);
|
RemoteName = Path.GetFileNameWithoutExtension (RemoteOriginUrl);
|
||||||
Domain = GetDomain (RemoteOriginUrl);
|
Domain = GetDomain (RemoteOriginUrl);
|
||||||
Description = GetDescription ();
|
Description = GetDescription ();
|
||||||
UserName = Config ["user.name"];
|
UserName = GetUserName ();
|
||||||
UserEmail = Config ["user.email"];
|
UserEmail = GetUserEmail ();
|
||||||
|
|
||||||
if (Head.CurrentCommit == null)
|
if (Head.CurrentCommit == null)
|
||||||
_CurrentHash = null;
|
_CurrentHash = null;
|
||||||
|
@ -706,6 +706,45 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string GetRemoteOriginUrl ()
|
||||||
|
{
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "config --get remote.origin.url");
|
||||||
|
git.Start ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
string output = git.StandardOutput.ReadToEnd ();
|
||||||
|
string url = output.Trim ();
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string GetUserName ()
|
||||||
|
{
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "config --get user.name");
|
||||||
|
git.Start ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
string output = git.StandardOutput.ReadToEnd ();
|
||||||
|
string user_name = output.Trim ();
|
||||||
|
|
||||||
|
return user_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string GetUserEmail ()
|
||||||
|
{
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "config --get user.email");
|
||||||
|
git.Start ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
string output = git.StandardOutput.ReadToEnd ();
|
||||||
|
string user_email = output.Trim ();
|
||||||
|
|
||||||
|
return user_email;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Recursively gets a folder's size in bytes
|
// Recursively gets a folder's size in bytes
|
||||||
private double CalculateFolderSize (DirectoryInfo parent)
|
private double CalculateFolderSize (DirectoryInfo parent)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue