diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index a076a37f..20e2ef50 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -212,13 +212,16 @@ namespace SparkleLib.Git { public override bool SyncUp () { - string message = FormatCommitMessage (); - - if (message != null) { - Add (); - Commit (message); + if (!Add ()) { + Error = ErrorStatus.UnreadableFiles; + return false; } + string message = FormatCommitMessage (); + + if (message != null) + Commit (message); + if (this.use_git_bin) { SparkleGitBin git_bin = new SparkleGitBin (LocalPath, "push"); git_bin.StartAndWaitForExit (); @@ -414,10 +417,12 @@ namespace SparkleLib.Git { // Stages the made changes - private void Add () + private bool Add () { SparkleGit git = new SparkleGit (LocalPath, "add --all"); git.StartAndWaitForExit (); + + return (git.ExitCode == 0); } @@ -478,7 +483,7 @@ namespace SparkleLib.Git { // Stop when we can't rebase due to locked local files // error: cannot stat 'filename': Permission denied if (error_output.Contains ("error: cannot stat")) { - Error = ErrorStatus.LockedFiles; + Error = ErrorStatus.UnreadableFiles; SparkleLogger.LogInfo ("Git", Name + " | Error status changed to " + Error); git = new SparkleGit (LocalPath, "rebase --abort"); diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 5de23235..9a7b91da 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -38,7 +38,7 @@ namespace SparkleLib { HostIdentityChanged, AuthenticationFailed, DiskSpaceExceeded, - LockedFiles, + UnreadableFiles, NotFound } @@ -264,6 +264,9 @@ namespace SparkleLib { do { SyncUpBase (); + if (Error == ErrorStatus.UnreadableFiles) + return; + } while (HasLocalChanges); } else { @@ -285,11 +288,8 @@ namespace SparkleLib { { if (Error == ErrorStatus.None || this.is_syncing) return; - - if (Error == ErrorStatus.LockedFiles) - SyncDownBase (); - else - SyncUpBase (); + + SyncUpBase (); } @@ -466,7 +466,6 @@ namespace SparkleLib { SparkleLogger.LogInfo (Name, "Syncing due to announcement"); SyncDownBase (); - } } diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 2a884967..94084f2f 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -283,8 +283,8 @@ namespace SparkleShare { } else if (repo.Error == ErrorStatus.DiskSpaceExceeded) { folder_errors.Add ("Host is out of disk space"); - } else if (repo.Error == ErrorStatus.LockedFiles) { - folder_errors.Add ("Some local files are locked or in use"); + } else if (repo.Error == ErrorStatus.UnreadableFiles) { + folder_errors.Add ("Some local files are unreadable or in use"); } else if (repo.Error == ErrorStatus.NotFound) { folder_errors.Add ("Project doesn't exist on host");