Closed tvollstaedt closed 11 years ago
I don't have word/excel at home, but I can see something similar with other software. I think the easiest way to fix this, is to ignore all files starting with a ~
. I have pushed a fix which should do that, but it will not change existing folders.
If you manually modify the file .git\info\exclude
and add a line containing
~*
it should fix this too.
This causes all files starting with a ~
not to be added any more. Can those temp files also be recognised by for example the extension? For example use something like ~*.doc[x]
?
Ignoring those files is only a workaround since this could be caused by any file locking software. I believe it would be much more efficient to check whether the file is readable for sparkleshare and skip it if not (or maybe add it to the exception list).
Temporary files are often also readable, so blacklisting is the only reliable means we have...
Sorry, i'm not very familiar with github yet, so i'm attaching this via comment meanwhile. It's a simple patch which basically solves the issue for me.
diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs
index f781d57..7d3d756 100644
--- a/SparkleLib/SparkleRepoBase.cs
+++ b/SparkleLib/SparkleRepoBase.cs
@@ -314,6 +314,19 @@ namespace SparkleLib {
!args.FullPath.Contains (Path.DirectorySeparatorChar + ".notes"))
return;
+ /*
+ * Check wheter 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. Skipping.");
+ return;
+ }
+
WatcherChangeTypes wct = args.ChangeType;
if (AnyDifferences) {
@tvollstaedt I wonder if that will also work when it's a different file that triggered the process. If a different file triggers the process whilst another file is unreadable, it could cause the same problem.
Okay, i wasn't so deep into sh code yet. Your'e right. In this case, we need to do both, skip the file and add it to exception list.
@hbons: I just pushed a branch for a fix on this topic. Please see my pull request for details.
@tvollstaedt, I have now merged your branch into the windows version. I leave this issue open until any problems are resolved and it is also merged into the linux version.
I've added an exclude rule for Office files: http://support.microsoft.com/kb/211632
~*.tmp
~*.tmp
seems not sufficient, see #20.
Closing all open issues - there are too many changes upstream, won't merge any more.
Opening a Microsoft Word or Excel file for example causing Sparkleshare to endlessly add the temporary files from office (~filename.ext). Since the add + commit fails, sparkleshare thinks there is still a change to commit --> causes an endless loop of commits and notifications.