repo git: reduce the number of status commands being called on activity

This commit is contained in:
Hylke Bons 2013-01-06 12:21:54 +01:00
parent 72beb68a4c
commit c1d6289507
2 changed files with 12 additions and 9 deletions

View file

@ -230,10 +230,10 @@ namespace SparkleLib.Git {
public override bool SyncUp ()
{
if (HasLocalChanges) {
Add ();
string message = FormatCommitMessage ();
string message = FormatCommitMessage ();
if (message != null) {
Add ();
Commit (message);
}
@ -456,11 +456,11 @@ namespace SparkleLib.Git {
// Merges the fetched changes
private bool Rebase ()
{
if (HasLocalChanges) {
string message = FormatCommitMessage ();
if (message != null) {
Add ();
string commit_message = FormatCommitMessage ();
Commit (commit_message);
Commit (message);
}
SparkleGit git;
@ -1046,7 +1046,10 @@ namespace SparkleLib.Git {
git_status.StandardOutput.ReadToEnd ();
git_status.WaitForExit ();
return message;
if (string.IsNullOrWhiteSpace (message))
return null;
else
return message;
}

View file

@ -245,12 +245,12 @@ namespace SparkleLib {
SparkleLogger.LogInfo ("Local", Name + " | Activity detected, waiting for it to settle...");
List<double> size_buffer = new List<double> ();
DirectoryInfo info = new DirectoryInfo (LocalPath);
do {
if (size_buffer.Count >= 4)
size_buffer.RemoveAt (0);
DirectoryInfo info = new DirectoryInfo (LocalPath);
size_buffer.Add (CalculateSize (info));
if (size_buffer.Count >= 4 &&