Fix bug where large amounts of files aren't being added/commited/pushed (process class hung on the large outputs)

This commit is contained in:
Hylke Bons 2011-07-21 00:02:21 +01:00
parent 164dea6c78
commit 55b75f84a8
2 changed files with 9 additions and 8 deletions

View file

@ -128,12 +128,11 @@ namespace SparkleLib {
public override bool SyncUp ()
{
Add ();
string message = FormatCommitMessage ();
Commit (message);
Commit ("Changes made by SparkleShare");
SparkleGit git = new SparkleGit (LocalPath, "push origin master");
git.Start ();
git.StandardOutput.ReadToEnd ();
git.WaitForExit ();
if (git.ExitCode == 0)
@ -228,11 +227,9 @@ namespace SparkleLib {
// Commits the made changes
private void Commit (string message)
{
if (!AnyDifferences)
return;
SparkleGit git = new SparkleGit (LocalPath, "commit -m \"" + message + "\"");
git.Start ();
git.StandardOutput.ReadToEnd ();
git.WaitForExit ();
SparkleHelpers.DebugInfo ("Commit", "[" + Name + "] " + message);
@ -268,7 +265,6 @@ namespace SparkleLib {
ResolveConflict ();
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict resolved.");
OnConflictResolved ();
}

View file

@ -276,6 +276,7 @@ namespace SparkleLib {
{
lock (this.change_lock) {
if (this.has_changed) {
Console.WriteLine ("checking...");
if (this.sizebuffer.Count >= 4)
this.sizebuffer.RemoveAt (0);
@ -317,6 +318,10 @@ namespace SparkleLib {
if (AnyDifferences) {
this.is_buffering = true;
// We want to disable wathcing temporarily, but
// not stop the local timer
this.watcher.EnableRaisingEvents = false;
// Only fire the event if the timer has been stopped.
// This prevents multiple events from being raised whilst "buffering".
if (!this.has_changed) {
@ -326,7 +331,7 @@ namespace SparkleLib {
SparkleHelpers.DebugInfo ("Event", "[" + Name + "] " + wct.ToString () + " '" + args.Name + "'");
SparkleHelpers.DebugInfo ("Event", "[" + Name + "] Changes found, checking if settled.");
this.remote_timer.Stop ();
lock (this.change_lock) {