repo git: check for errors moving files when rebasing. add more debug info
This commit is contained in:
parent
45ee5cc8f3
commit
007f26227c
|
@ -51,6 +51,9 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
|
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
|
||||||
|
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase true");
|
||||||
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
while (Directory.Exists (rebase_apply_path) && HasLocalChanges) {
|
while (Directory.Exists (rebase_apply_path) && HasLocalChanges) {
|
||||||
try {
|
try {
|
||||||
ResolveConflict ();
|
ResolveConflict ();
|
||||||
|
@ -60,7 +63,10 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "rev-parse --abbrev-ref HEAD");
|
git = new SparkleGit (LocalPath, "config core.ignorecase false");
|
||||||
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
|
git = new SparkleGit (LocalPath, "rev-parse --abbrev-ref HEAD");
|
||||||
this.cached_branch = git.StartAndReadStandardOutput ();
|
this.cached_branch = git.StartAndReadStandardOutput ();
|
||||||
|
|
||||||
return this.cached_branch;
|
return this.cached_branch;
|
||||||
|
@ -560,12 +566,14 @@ namespace SparkleLib.Git {
|
||||||
foreach (string line in lines) {
|
foreach (string line in lines) {
|
||||||
string conflicting_path = line.Substring (3);
|
string conflicting_path = line.Substring (3);
|
||||||
conflicting_path = EnsureSpecialCharacters (conflicting_path);
|
conflicting_path = EnsureSpecialCharacters (conflicting_path);
|
||||||
conflicting_path = conflicting_path.Replace ("\"", "\\\"");
|
conflicting_path = conflicting_path.Trim ("\"".ToCharArray ());
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
SparkleLogger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
||||||
|
|
||||||
// Ignore conflicts in the .sparkleshare file and use the local version
|
// Ignore conflicts in the .sparkleshare file and use the local version
|
||||||
if (conflicting_path.EndsWith (".sparkleshare") || conflicting_path.EndsWith (".empty")) {
|
if (conflicting_path.EndsWith (".sparkleshare") || conflicting_path.EndsWith (".empty")) {
|
||||||
|
SparkleLogger.LogInfo ("Git", Name + " | Ignoring conflict in special file: " + conflicting_path);
|
||||||
|
|
||||||
// Recover local version
|
// Recover local version
|
||||||
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\"");
|
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\"");
|
||||||
git_theirs.StartAndWaitForExit ();
|
git_theirs.StartAndWaitForExit ();
|
||||||
|
@ -580,6 +588,8 @@ namespace SparkleLib.Git {
|
||||||
if (line.StartsWith ("UU") || line.StartsWith ("AA") ||
|
if (line.StartsWith ("UU") || line.StartsWith ("AA") ||
|
||||||
line.StartsWith ("AU") || line.StartsWith ("UA")) {
|
line.StartsWith ("AU") || line.StartsWith ("UA")) {
|
||||||
|
|
||||||
|
SparkleLogger.LogInfo ("Git", Name + " | Resolving: " + line);
|
||||||
|
|
||||||
// Recover local version
|
// Recover local version
|
||||||
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\"");
|
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\"");
|
||||||
git_theirs.StartAndWaitForExit ();
|
git_theirs.StartAndWaitForExit ();
|
||||||
|
@ -594,7 +604,8 @@ namespace SparkleLib.Git {
|
||||||
string abs_conflicting_path = Path.Combine (LocalPath, conflicting_path);
|
string abs_conflicting_path = Path.Combine (LocalPath, conflicting_path);
|
||||||
string abs_their_path = Path.Combine (LocalPath, their_path);
|
string abs_their_path = Path.Combine (LocalPath, their_path);
|
||||||
|
|
||||||
File.Move (abs_conflicting_path, abs_their_path);
|
if (File.Exists (abs_conflicting_path) && !File.Exists (abs_their_path))
|
||||||
|
File.Move (abs_conflicting_path, abs_their_path);
|
||||||
|
|
||||||
// Recover server version
|
// Recover server version
|
||||||
SparkleGit git_ours = new SparkleGit (LocalPath, "checkout --ours \"" + conflicting_path + "\"");
|
SparkleGit git_ours = new SparkleGit (LocalPath, "checkout --ours \"" + conflicting_path + "\"");
|
||||||
|
@ -604,12 +615,17 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
// The local version has been modified, but the server version was removed
|
// The local version has been modified, but the server version was removed
|
||||||
} else if (line.StartsWith ("DU")) {
|
} else if (line.StartsWith ("DU")) {
|
||||||
|
SparkleLogger.LogInfo ("Git", Name + " | Resolving: " + line);
|
||||||
|
|
||||||
// The modified local version is already in the checkout, so it just needs to be added.
|
// The modified local version is already in the checkout, so it just needs to be added.
|
||||||
// We need to specifically mention the file, so we can't reuse the Add () method
|
// We need to specifically mention the file, so we can't reuse the Add () method
|
||||||
SparkleGit git_add = new SparkleGit (LocalPath, "add \"" + conflicting_path + "\"");
|
SparkleGit git_add = new SparkleGit (LocalPath, "add \"" + conflicting_path + "\"");
|
||||||
git_add.StartAndWaitForExit ();
|
git_add.StartAndWaitForExit ();
|
||||||
|
|
||||||
changes_added = true;
|
changes_added = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
SparkleLogger.LogInfo ("Git", Name + " | No need to resolve: " + line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue