repo git: error out when files can't be added to the database. closes #1212
This commit is contained in:
parent
69c8116ae1
commit
4dfafdb2a7
|
@ -212,12 +212,15 @@ namespace SparkleLib.Git {
|
|||
|
||||
public override bool SyncUp ()
|
||||
{
|
||||
if (!Add ()) {
|
||||
Error = ErrorStatus.UnreadableFiles;
|
||||
return false;
|
||||
}
|
||||
|
||||
string message = FormatCommitMessage ();
|
||||
|
||||
if (message != null) {
|
||||
Add ();
|
||||
if (message != null)
|
||||
Commit (message);
|
||||
}
|
||||
|
||||
if (this.use_git_bin) {
|
||||
SparkleGitBin git_bin = new SparkleGitBin (LocalPath, "push");
|
||||
|
@ -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");
|
||||
|
|
|
@ -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 {
|
||||
|
@ -286,9 +289,6 @@ namespace SparkleLib {
|
|||
if (Error == ErrorStatus.None || this.is_syncing)
|
||||
return;
|
||||
|
||||
if (Error == ErrorStatus.LockedFiles)
|
||||
SyncDownBase ();
|
||||
else
|
||||
SyncUpBase ();
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,6 @@ namespace SparkleLib {
|
|||
|
||||
SparkleLogger.LogInfo (Name, "Syncing due to announcement");
|
||||
SyncDownBase ();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue