diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 9025c575..67d487d5 100755 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -137,10 +137,12 @@ namespace SparkleLib { public override bool SyncUp () { - Add (); + if (AnyDifferences) { + Add (); - string message = FormatCommitMessage (); - Commit (message); + string message = FormatCommitMessage (); + Commit (message); + } SparkleGit git = new SparkleGit (LocalPath, "push origin master"); git.Start (); diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index f9f8087e..4be397e5 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -116,7 +116,7 @@ namespace SparkleLib { // In the unlikely case that we haven't synced up our // changes or the server was down, sync up again - if (HasUnsyncedChanges) + if (HasUnsyncedChanges && !IsSyncing && this.server_online) SyncUpBase (); }; @@ -180,7 +180,7 @@ namespace SparkleLib { } - public virtual bool CheckForRemoteChanges () // HasRemoteChanges { get; } ? + public virtual bool CheckForRemoteChanges () // TODO: HasRemoteChanges { get; } { return true; } @@ -432,8 +432,9 @@ namespace SparkleLib { HasUnsyncedChanges = true; SyncDownBase (); + DisableWatching (); - if (SyncUp ()) { + if (this.server_online && SyncUp ()) { HasUnsyncedChanges = false; if (SyncStatusChanged != null) @@ -442,6 +443,8 @@ namespace SparkleLib { this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision)); } else { + this.server_online = false; + if (SyncStatusChanged != null) SyncStatusChanged (SyncStatus.Error); }