repo git: when things are utterly wrong, abandon rebase

This commit is contained in:
Hylke Bons 2012-12-19 21:57:55 +01:00
parent d71a91efcd
commit 268507d4d0

View file

@ -466,9 +466,20 @@ namespace SparkleLib.Git {
Commit (commit_message); Commit (commit_message);
} }
SparkleGit git;
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
// Stop if we're already in a rebase because something went wrong
if (Directory.Exists (rebase_apply_path)) {
git = new SparkleGit (LocalPath, "rebase --abort");
git.StartAndWaitForExit ();
return false;
}
// Temporarily change the ignorecase setting to true to avoid // Temporarily change the ignorecase setting to true to avoid
// conflicts in file names due to case changes // conflicts in file names due to letter case changes
SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase true"); git = new SparkleGit (LocalPath, "config core.ignorecase true");
git.StartAndWaitForExit (); git.StartAndWaitForExit ();
git = new SparkleGit (LocalPath, "rebase FETCH_HEAD"); git = new SparkleGit (LocalPath, "rebase FETCH_HEAD");
@ -493,7 +504,6 @@ namespace SparkleLib.Git {
} else { } else {
SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out..."); SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out...");
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
while (Directory.Exists (rebase_apply_path) && HasLocalChanges) { while (Directory.Exists (rebase_apply_path) && HasLocalChanges) {
try { try {