repo git: temporarily set core.ignorecase=true when rebasing to prevent conflicts. fixes #721

This commit is contained in:
Hylke Bons 2012-11-11 19:15:42 +00:00
parent 76df36f734
commit c60153b90c
2 changed files with 38 additions and 6 deletions

View file

@ -56,12 +56,26 @@ namespace SparkleLib.Git {
public string StartAndReadStandardOutput ()
{
Start ();
// Reading the standard output HAS to go before
// WaitForExit, or it will hang forever on output > 4096 bytes
string output = StandardOutput.ReadToEnd ();
WaitForExit ();
return output.TrimEnd ();
}
public string StartAndReadStandardError ()
{
StartInfo.RedirectStandardError = true;
Start ();
// Reading the standard output HAS to go before
// WaitForExit, or it will hang forever on output > 4096 bytes
string output = StandardError.ReadToEnd ();
WaitForExit ();
return output.TrimEnd ();
}

View file

@ -37,8 +37,11 @@ namespace SparkleLib.Git {
{
// TODO: Set git locale to en-US
SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase false");
git.StartAndWaitForExit ();
// Check if we should use git-bin
SparkleGit git = new SparkleGit (LocalPath, "config --get filter.bin.clean");
git = new SparkleGit (LocalPath, "config --get filter.bin.clean");
git.StartAndWaitForExit ();
this.use_git_bin = (git.ExitCode == 0);
@ -415,26 +418,41 @@ namespace SparkleLib.Git {
Commit (commit_message);
}
SparkleGit git = new SparkleGit (LocalPath, "rebase FETCH_HEAD");
git.StartInfo.RedirectStandardOutput = 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");
git.StartAndWaitForExit ();
git = new SparkleGit (LocalPath, "rebase FETCH_HEAD");
git.StartInfo.RedirectStandardOutput = false;
string error_output = git.StartAndReadStandardError ();
if (git.ExitCode != 0) {
SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out...");
// error: cannot stat 'filename': Permission denied
if (SparkleBackend.Platform != PlatformID.Unix &&
error_output.Contains ("error: cannot stat")) {
// TODO
}
while (HasLocalChanges) {
try {
ResolveConflict ();
} catch (IOException e) {
SparkleLogger.LogInfo ("Git",
Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
}
}
SparkleLogger.LogInfo ("Git", Name + " | Conflict resolved");
OnConflictResolved ();
}
git = new SparkleGit (LocalPath, "config core.ignorecase false");
git.StartAndWaitForExit ();
}