Browse code

FileDict: don't record md5 for zero-length files

This allows us to sync zero-length files from S3 without
hardlinking all the zero-length files together or
remote copying the zero-length files.

Matt Domsch authored on 2014/03/13 04:31:33
Showing 1 changed files
... ...
@@ -6,6 +6,8 @@
6 6
 from SortedDict import SortedDict
7 7
 import Utils
8 8
 
9
+zero_length_md5 = "d41d8cd98f00b204e9800998ecf8427e"
10
+
9 11
 class FileDict(SortedDict):
10 12
     def __init__(self, mapping = {}, ignore_case = True, **kwargs):
11 13
         SortedDict.__init__(self, mapping = mapping, ignore_case = ignore_case, **kwargs)
... ...
@@ -13,6 +15,7 @@ class FileDict(SortedDict):
13 13
         self.by_md5 = dict() # {md5: set(relative_files)}
14 14
 
15 15
     def record_md5(self, relative_file, md5):
16
+        if md5 == zero_length_md5: return
16 17
         if md5 not in self.by_md5:
17 18
             self.by_md5[md5] = set()
18 19
         self.by_md5[md5].add(relative_file)