File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -79,18 +79,29 @@ - (BOOL) _indexChanged {
7979}
8080
8181- (BOOL ) _gitDirectoryChanged {
82- BOOL isDirectory;
83- NSDate *touchDate;
8482
85- for (NSString *filename in [[NSFileManager defaultManager ] directoryContentsAtPath: repository.fileURL.path]) {
86- NSString *filepath = [repository.fileURL.path stringByAppendingPathComponent: filename];
87- [[NSFileManager defaultManager ] fileExistsAtPath: filepath isDirectory: &isDirectory];
83+ for (NSURL * fileURL in [[NSFileManager defaultManager ] contentsOfDirectoryAtURL: repository.fileURL
84+ includingPropertiesForKeys: [NSArray arrayWithObject: NSURLContentModificationDateKey ]
85+ options: 0
86+
87+ error: nil ])
88+ {
89+ BOOL isDirectory = NO ;
90+ [[NSFileManager defaultManager ] fileExistsAtPath: [fileURL path ] isDirectory: &isDirectory];
8891 if (isDirectory)
8992 continue ;
9093
91- touchDate = [self _fileModificationDateAtPath: filepath];
92- if ([gitDirTouchDate isLessThan: touchDate]) {
93- gitDirTouchDate = touchDate;
94+ NSDate * modTime = nil ;
95+ if (![fileURL getResourceValue: &modTime forKey: NSURLContentModificationDateKey error: nil ])
96+ continue ;
97+
98+ if (gitDirTouchDate == nil || [modTime compare: gitDirTouchDate] == NSOrderedDescending)
99+ {
100+ NSDate * newModTime = [[modTime laterDate: gitDirTouchDate] retain ];
101+ if (gitDirTouchDate)
102+ [gitDirTouchDate release ];
103+
104+ gitDirTouchDate = newModTime;
94105 return YES ;
95106 }
96107 }
You can’t perform that action at this time.
0 commit comments