From 268507d4d0b1640e2b254bcf2bffe1a0d9dd4993 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 19 Dec 2012 21:57:55 +0100 Subject: [PATCH] repo git: when things are utterly wrong, abandon rebase --- SparkleLib/Git/SparkleRepoGit.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 020bdf5e..47fa6cbb 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -466,9 +466,20 @@ namespace SparkleLib.Git { 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 - // conflicts in file names due to case changes - SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase true"); + // conflicts in file names due to letter case changes + git = new SparkleGit (LocalPath, "config core.ignorecase true"); git.StartAndWaitForExit (); git = new SparkleGit (LocalPath, "rebase FETCH_HEAD"); @@ -493,7 +504,6 @@ namespace SparkleLib.Git { } else { 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) { try {