From 8948837a597dca726ea1e82a31b00defe59359b6 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 20 Nov 2012 20:33:02 +0000 Subject: [PATCH] repo git: fix getting stuck in conflict resolution loop when there are no conflicts --- SparkleLib/Git/SparkleRepoGit.cs | 19 +++++++++---------- SparkleShare/Windows/SparkleController.cs | 10 ++++------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index d50afc6b..00fc6f76 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -49,14 +49,12 @@ namespace SparkleLib.Git { if (string.IsNullOrEmpty (this.cached_branch)) { string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine (); - if (Directory.Exists (rebase_apply_path)) { - while (HasLocalChanges) { - try { - ResolveConflict (); - - } catch (IOException e) { - SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")"); - } + while (Directory.Exists (rebase_apply_path) && HasLocalChanges) { + try { + ResolveConflict (); + + } catch (IOException e) { + SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")"); } } @@ -477,8 +475,9 @@ namespace SparkleLib.Git { } SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out..."); - - while (HasLocalChanges) { + string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine (); + + while (Directory.Exists (rebase_apply_path) && HasLocalChanges) { try { ResolveConflict (); diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 1483ce43..b3ec49bb 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -199,7 +199,7 @@ namespace SparkleShare { if (!string.IsNullOrEmpty (auth_agent_pid)) { SparkleLogger.LogInfo ("Controller", "Trying to use existing ssh-agent with PID=" + auth_agent_pid + "..."); - this.ssh_agent_pid = Convert.ToInt32(auth_agent_pid); + this.ssh_agent_pid = Convert.ToInt32 (auth_agent_pid); try { Process ssh_agent = Process.GetProcessById (this.ssh_agent_pid); @@ -230,12 +230,10 @@ namespace SparkleShare { Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK", auth_sock_match.Groups [1].Value); if (ssh_pid_match.Success) { - string ssh_pid = ssh_pid_match.Groups [1].Value; + Int32.TryParse (ssh_pid_match.Groups [1].Value, out this.ssh_agent_pid); + Environment.SetEnvironmentVariable ("SSH_AGENT_PID", this.ssh_agent_pid); - Int32.TryParse (ssh_pid, out this.ssh_agent_pid); - Environment.SetEnvironmentVariable ("SSH_AGENT_PID", ssh_pid); - - SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=" + ssh_pid); + SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=" + this.ssh_agent_pid); } else { SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=Unknown");