repo git: check if remote rev is in local history when determining state. closes #1155

This commit is contained in:
Hylke Bons 2013-01-24 20:10:42 +00:00
parent ee4df60f25
commit 1c8ffe407f

View file

@ -211,19 +211,27 @@ namespace SparkleLib.Git {
if (git.ExitCode != 0)
return false;
string remote_revision = output.Substring (0, 40);
string remote_revision = "" + output.Substring (0, 40);
if (!string.IsNullOrEmpty (remote_revision) && !remote_revision.StartsWith (current_revision)) {
SparkleLogger.LogInfo ("Git", Name + " | Remote changes found, local: " +
current_revision + ", remote: " + remote_revision);
if (!remote_revision.Equals (current_revision)) {
git = new SparkleGit (LocalPath, "merge-base " + remote_revision + " master");
git.StartAndWaitForExit ();
Error = ErrorStatus.None;
return true;
if (git.ExitCode != 0) {
SparkleLogger.LogInfo ("Git", Name + " | Remote changes found, local: " +
current_revision + ", remote: " + remote_revision);
} else {
SparkleLogger.LogInfo ("Git", Name + " | No remote changes, local+remote: " + current_revision);
return false;
}
Error = ErrorStatus.None;
return true;
} else {
SparkleLogger.LogInfo ("Git", Name + " | Remote " + remote_revision + " is already in our history");
return false;
}
}
SparkleLogger.LogInfo ("Git", Name + " | No remote changes, local+remote: " + current_revision);
return false;
}
}