fix a regression with truncation detection

This commit is contained in:
Sridhar Ratnakumar 2013-05-29 15:08:24 -07:00
parent de27e252a7
commit 68dffd22b4
2 changed files with 3 additions and 0 deletions

View File

@ -107,6 +107,7 @@ func (fw *InotifyFileWatcher) ChangeEvents(t tomb.Tomb, fi os.FileInfo) *FileCha
}else{ }else{
changes.NotifyModified() changes.NotifyModified()
} }
prevSize = fw.Size
} }
} }
}() }()

View File

@ -80,8 +80,10 @@ func (fw *PollingFileWatcher) ChangeEvents(t tomb.Tomb, origFi os.FileInfo) *Fil
fw.Size = fi.Size() fw.Size = fi.Size()
if prevSize > 0 && prevSize > fw.Size { if prevSize > 0 && prevSize > fw.Size {
changes.NotifyTruncated() changes.NotifyTruncated()
prevSize = fw.Size
continue continue
} }
prevSize = fw.Size
// File was appended to (changed)? // File was appended to (changed)?
modTime := fi.ModTime() modTime := fi.ModTime()