lib: Check if we're in the middle on a rebase on startup, if so: abort

This commit is contained in:
Hylke Bons 2012-07-25 11:41:51 +02:00
parent afd894ac50
commit 687cbd4b60
2 changed files with 13 additions and 16 deletions

View file

@ -39,6 +39,14 @@ namespace SparkleLib.Git {
git.WaitForExit (); git.WaitForExit ();
this.use_git_bin = (git.ExitCode == 0); this.use_git_bin = (git.ExitCode == 0);
string rebase_apply_path = SparkleHelpers.CombineMore (LocalPath, ".git", "rebase-apply");
if (Directory.Exists (rebase_apply_path)) {
SparkleGit git = new SparkleGit (LocalPath, "rebase --abort");
git.Start ();
git.WaitForExit ();
}
} }
@ -127,13 +135,6 @@ namespace SparkleLib.Git {
public override string CurrentRevision { public override string CurrentRevision {
get { get {
// Remove stale rebase-apply files because it
// makes the method return the wrong hashes.
string rebase_apply_file = SparkleHelpers.CombineMore (LocalPath, ".git", "rebase-apply");
if (File.Exists (rebase_apply_file))
File.Delete (rebase_apply_file);
SparkleGit git = new SparkleGit (LocalPath, "rev-parse HEAD"); SparkleGit git = new SparkleGit (LocalPath, "rev-parse HEAD");
git.Start (); git.Start ();
@ -141,7 +142,7 @@ namespace SparkleLib.Git {
git.WaitForExit (); git.WaitForExit ();
if (git.ExitCode == 0) if (git.ExitCode == 0)
return output.TrimEnd (); return output.Trim ();
else else
return null; return null;
} }

View file

@ -402,19 +402,15 @@ namespace SparkleShare {
public void OnFolderActivity (object o, FileSystemEventArgs args) public void OnFolderActivity (object o, FileSystemEventArgs args)
{ {
if (args != null && if (args != null && args.FullPath.EndsWith (".xml") &&
args.ChangeType == WatcherChangeTypes.Created && args.ChangeType == WatcherChangeTypes.Created) {
args.FullPath.EndsWith (".xml")) {
HandleInvite (args); HandleInvite (args);
return; return;
} else { } else {
if (Directory.Exists (args.FullPath) && if (Directory.Exists (args.FullPath) && args.ChangeType == WatcherChangeTypes.Created)
args.ChangeType == WatcherChangeTypes.Created) {
return; return;
}
CheckRepositories (); CheckRepositories ();
} }