// Merges the fetched changes bool Merge() { string message = FormatCommitMessage(); if (message != null) { Add(); Commit(message); } GitCommand git; // Stop if we're already in a merge because something went wrong if (this.in_merge) { git = new GitCommand(LocalPath, "merge --abort"); git.StartAndWaitForExit(); return(false); } // Temporarily change the ignorecase setting to true to avoid // conflicts in file names due to letter case changes git = new GitCommand(LocalPath, "config core.ignorecase true"); git.StartAndWaitForExit(); git = new GitCommand(LocalPath, "merge FETCH_HEAD"); git.StartInfo.RedirectStandardOutput = false; string error_output = git.StartAndReadStandardError(); if (git.ExitCode != 0) { // Stop when we can't merge due to locked local files // error: cannot stat 'filename': Permission denied if (error_output.Contains("error: cannot stat")) { Error = ErrorStatus.UnreadableFiles; Logger.LogInfo("Git", Name + " | Error status changed to " + Error); git = new GitCommand(LocalPath, "merge --abort"); git.StartAndWaitForExit(); git = new GitCommand(LocalPath, "config core.ignorecase false"); git.StartAndWaitForExit(); return(false); } else { Logger.LogInfo("Git", error_output); Logger.LogInfo("Git", Name + " | Conflict detected, trying to get out..."); while (this.in_merge && HasLocalChanges) { try { ResolveConflict(); } catch (Exception e) { Logger.LogInfo("Git", Name + " | Failed to resolve conflict, trying again...", e); } } Logger.LogInfo("Git", Name + " | Conflict resolved"); } } git = new GitCommand(LocalPath, "config core.ignorecase false"); git.StartAndWaitForExit(); return(true); }
// Merges the fetched changes bool Merge() { string message = FormatCommitMessage (); if (message != null) { Add (); Commit (message); } GitCommand git; // Stop if we're already in a merge because something went wrong if (this.in_merge) { git = new GitCommand (LocalPath, "merge --abort"); git.StartAndWaitForExit (); return false; } // Temporarily change the ignorecase setting to true to avoid // conflicts in file names due to letter case changes git = new GitCommand (LocalPath, "config core.ignorecase true"); git.StartAndWaitForExit (); git = new GitCommand (LocalPath, "merge FETCH_HEAD"); git.StartInfo.RedirectStandardOutput = false; string error_output = git.StartAndReadStandardError (); if (git.ExitCode != 0) { // Stop when we can't merge due to locked local files // error: cannot stat 'filename': Permission denied if (error_output.Contains ("error: cannot stat")) { Error = ErrorStatus.UnreadableFiles; Logger.LogInfo ("Git", Name + " | Error status changed to " + Error); git = new GitCommand (LocalPath, "merge --abort"); git.StartAndWaitForExit (); git = new GitCommand (LocalPath, "config core.ignorecase false"); git.StartAndWaitForExit (); return false; } else { Logger.LogInfo ("Git", error_output); Logger.LogInfo ("Git", Name + " | Conflict detected, trying to get out..."); while (this.in_merge && HasLocalChanges) { try { ResolveConflict (); } catch (Exception e) { Logger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again...", e); } } Logger.LogInfo ("Git", Name + " | Conflict resolved"); } } git = new GitCommand (LocalPath, "config core.ignorecase false"); git.StartAndWaitForExit (); return true; }