[repo] add back empty repo check without Git#
This commit is contained in:
parent
949e2ed464
commit
e609c0b3a4
|
@ -141,13 +141,6 @@ namespace SparkleLib {
|
||||||
Description = GetDescription ();
|
Description = GetDescription ();
|
||||||
UserName = GetUserName ();
|
UserName = GetUserName ();
|
||||||
UserEmail = GetUserEmail ();
|
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;
|
_IsSyncing = false;
|
||||||
_IsBuffering = false;
|
_IsBuffering = false;
|
||||||
_IsPolling = true;
|
_IsPolling = true;
|
||||||
|
@ -158,6 +151,11 @@ namespace SparkleLib {
|
||||||
ChangeLock = new Object ();
|
ChangeLock = new Object ();
|
||||||
FetchRequests = 0;
|
FetchRequests = 0;
|
||||||
|
|
||||||
|
if (IsEmpty)
|
||||||
|
_CurrentHash = null;
|
||||||
|
else
|
||||||
|
_CurrentHash = GetCurrentHash ();
|
||||||
|
|
||||||
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath,
|
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath,
|
||||||
".git", "has_unsynced_changes");
|
".git", "has_unsynced_changes");
|
||||||
|
|
||||||
|
@ -408,7 +406,7 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool AnyDifferences {
|
private bool AnyDifferences {
|
||||||
get {
|
get {
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
||||||
git.Start ();
|
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 ()
|
private string GetCurrentHash ()
|
||||||
{
|
{
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "log -1 --format=%H");
|
SparkleGit git = new SparkleGit (LocalPath, "log -1 --format=%H");
|
||||||
|
|
Loading…
Reference in a new issue