From 85abd6bbb76beb9ac2a1b2c22db6d03f01dfbffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Mon, 5 Sep 2011 03:10:50 +0200 Subject: [PATCH] Skipping files which are unreadable by sparkleshare and added some methods for git's exclude file manipulation, see #10 --- SparkleLib/SparkleRepoBase.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 70cb9808..6af276d9 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -64,6 +64,10 @@ namespace SparkleLib { public abstract bool SyncDown (); public abstract bool HasUnsyncedChanges { get; set; } + public abstract bool AddExclusionRule (FileSystemEventArgs args); + public abstract bool RemoveExclusionRule (FileSystemEventArgs args); + public abstract bool CheckExclusionRules (); + public delegate void SyncStatusChangedEventHandler (SyncStatus new_status); public event SyncStatusChangedEventHandler SyncStatusChanged; @@ -316,6 +320,20 @@ namespace SparkleLib { !args.FullPath.Contains (Path.DirectorySeparatorChar + ".notes")) return; + /* + * Check whether the file which triggered the action + * is readable so that git can actually commit it + */ + + try { + FileStream file = File.OpenRead(args.FullPath); + file.Close(); + } catch { + SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list."); + AddExclusionRule(args); + return; + } + WatcherChangeTypes wct = args.ChangeType; if (AnyDifferences) {