fetcher git: simplify
This commit is contained in:
parent
ac7359428c
commit
187f4d3ad5
|
@ -211,14 +211,7 @@ namespace SparkleLib.Git {
|
||||||
public override bool IsFetchedRepoEmpty {
|
public override bool IsFetchedRepoEmpty {
|
||||||
get {
|
get {
|
||||||
SparkleGit git = new SparkleGit (TargetFolder, "rev-parse HEAD");
|
SparkleGit git = new SparkleGit (TargetFolder, "rev-parse HEAD");
|
||||||
git.StartInfo.RedirectStandardError = true;
|
git.StartAndWaitForExit ();
|
||||||
git.Start ();
|
|
||||||
|
|
||||||
// Reading the standard output HAS to go before
|
|
||||||
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
||||||
git.StandardOutput.ReadToEnd ();
|
|
||||||
git.StandardError.ReadToEnd ();
|
|
||||||
git.WaitForExit ();
|
|
||||||
|
|
||||||
return (git.ExitCode != 0);
|
return (git.ExitCode != 0);
|
||||||
}
|
}
|
||||||
|
@ -257,17 +250,12 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
if (!File.Exists (password_check_file_path)) {
|
if (!File.Exists (password_check_file_path)) {
|
||||||
SparkleGit git = new SparkleGit (TargetFolder, "show HEAD:.sparkleshare");
|
SparkleGit git = new SparkleGit (TargetFolder, "show HEAD:.sparkleshare");
|
||||||
git.Start ();
|
string output = git.StartAndReadStandardOutput ();
|
||||||
|
|
||||||
// Reading the standard output HAS to go before
|
if (git.ExitCode == 0)
|
||||||
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
||||||
string output = git.StandardOutput.ReadToEnd ();
|
|
||||||
git.WaitForExit ();
|
|
||||||
|
|
||||||
if (git.ExitCode != 0)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
File.WriteAllText (password_check_file_path, output);
|
File.WriteAllText (password_check_file_path, output);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Process process = new Process () {
|
Process process = new Process () {
|
||||||
|
|
Loading…
Reference in a new issue