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 ()
|
public override bool SyncUp ()
|
||||||
{
|
{
|
||||||
|
if (!Add ()) {
|
||||||
|
Error = ErrorStatus.UnreadableFiles;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
string message = FormatCommitMessage ();
|
string message = FormatCommitMessage ();
|
||||||
|
|
||||||
if (message != null) {
|
if (message != null)
|
||||||
Add ();
|
|
||||||
Commit (message);
|
Commit (message);
|
||||||
}
|
|
||||||
|
|
||||||
if (this.use_git_bin) {
|
if (this.use_git_bin) {
|
||||||
SparkleGitBin git_bin = new SparkleGitBin (LocalPath, "push");
|
SparkleGitBin git_bin = new SparkleGitBin (LocalPath, "push");
|
||||||
|
@ -414,10 +417,12 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
|
|
||||||
// Stages the made changes
|
// Stages the made changes
|
||||||
private void Add ()
|
private bool Add ()
|
||||||
{
|
{
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "add --all");
|
SparkleGit git = new SparkleGit (LocalPath, "add --all");
|
||||||
git.StartAndWaitForExit ();
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
|
return (git.ExitCode == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -478,7 +483,7 @@ namespace SparkleLib.Git {
|
||||||
// Stop when we can't rebase due to locked local files
|
// Stop when we can't rebase due to locked local files
|
||||||
// error: cannot stat 'filename': Permission denied
|
// error: cannot stat 'filename': Permission denied
|
||||||
if (error_output.Contains ("error: cannot stat")) {
|
if (error_output.Contains ("error: cannot stat")) {
|
||||||
Error = ErrorStatus.LockedFiles;
|
Error = ErrorStatus.UnreadableFiles;
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Error status changed to " + Error);
|
SparkleLogger.LogInfo ("Git", Name + " | Error status changed to " + Error);
|
||||||
|
|
||||||
git = new SparkleGit (LocalPath, "rebase --abort");
|
git = new SparkleGit (LocalPath, "rebase --abort");
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace SparkleLib {
|
||||||
HostIdentityChanged,
|
HostIdentityChanged,
|
||||||
AuthenticationFailed,
|
AuthenticationFailed,
|
||||||
DiskSpaceExceeded,
|
DiskSpaceExceeded,
|
||||||
LockedFiles,
|
UnreadableFiles,
|
||||||
NotFound
|
NotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,6 +264,9 @@ namespace SparkleLib {
|
||||||
do {
|
do {
|
||||||
SyncUpBase ();
|
SyncUpBase ();
|
||||||
|
|
||||||
|
if (Error == ErrorStatus.UnreadableFiles)
|
||||||
|
return;
|
||||||
|
|
||||||
} while (HasLocalChanges);
|
} while (HasLocalChanges);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -286,9 +289,6 @@ namespace SparkleLib {
|
||||||
if (Error == ErrorStatus.None || this.is_syncing)
|
if (Error == ErrorStatus.None || this.is_syncing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Error == ErrorStatus.LockedFiles)
|
|
||||||
SyncDownBase ();
|
|
||||||
else
|
|
||||||
SyncUpBase ();
|
SyncUpBase ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,6 @@ namespace SparkleLib {
|
||||||
|
|
||||||
SparkleLogger.LogInfo (Name, "Syncing due to announcement");
|
SparkleLogger.LogInfo (Name, "Syncing due to announcement");
|
||||||
SyncDownBase ();
|
SyncDownBase ();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,8 +283,8 @@ namespace SparkleShare {
|
||||||
} else if (repo.Error == ErrorStatus.DiskSpaceExceeded) {
|
} else if (repo.Error == ErrorStatus.DiskSpaceExceeded) {
|
||||||
folder_errors.Add ("Host is out of disk space");
|
folder_errors.Add ("Host is out of disk space");
|
||||||
|
|
||||||
} else if (repo.Error == ErrorStatus.LockedFiles) {
|
} else if (repo.Error == ErrorStatus.UnreadableFiles) {
|
||||||
folder_errors.Add ("Some local files are locked or in use");
|
folder_errors.Add ("Some local files are unreadable or in use");
|
||||||
|
|
||||||
} else if (repo.Error == ErrorStatus.NotFound) {
|
} else if (repo.Error == ErrorStatus.NotFound) {
|
||||||
folder_errors.Add ("Project doesn't exist on host");
|
folder_errors.Add ("Project doesn't exist on host");
|
||||||
|
|
Loading…
Reference in a new issue