[repo] add back empty repo check without Git#
This commit is contained in:
parent
ff779d6932
commit
6213b95ef1
|
@ -141,13 +141,6 @@ namespace SparkleLib {
|
|||
Description = GetDescription ();
|
||||
UserName = GetUserName ();
|
||||
UserEmail = GetUserEmail ();
|
||||
|
||||
// TODO: replace this with a check on the number of objects in .git/objects/ (empty if 2)
|
||||
// if (Head.CurrentCommit == null)
|
||||
// _CurrentHash = null;
|
||||
// else
|
||||
_CurrentHash = GetCurrentHash ();
|
||||
|
||||
_IsSyncing = false;
|
||||
_IsBuffering = false;
|
||||
_IsPolling = true;
|
||||
|
@ -158,6 +151,11 @@ namespace SparkleLib {
|
|||
ChangeLock = new Object ();
|
||||
FetchRequests = 0;
|
||||
|
||||
if (IsEmpty)
|
||||
_CurrentHash = null;
|
||||
else
|
||||
_CurrentHash = GetCurrentHash ();
|
||||
|
||||
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath,
|
||||
".git", "has_unsynced_changes");
|
||||
|
||||
|
@ -408,7 +406,7 @@ namespace SparkleLib {
|
|||
}
|
||||
|
||||
|
||||
public bool AnyDifferences {
|
||||
private bool AnyDifferences {
|
||||
get {
|
||||
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
||||
git.Start ();
|
||||
|
@ -427,6 +425,17 @@ namespace SparkleLib {
|
|||
}
|
||||
|
||||
|
||||
private bool IsEmpty {
|
||||
get {
|
||||
SparkleGit git = new SparkleGit (LocalPath, "log -1");
|
||||
git.Start ();
|
||||
git.WaitForExit ();
|
||||
|
||||
return (git.ExitCode != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string GetCurrentHash ()
|
||||
{
|
||||
SparkleGit git = new SparkleGit (LocalPath, "log -1 --format=%H");
|
||||
|
|
Loading…
Reference in a new issue