Merge pull request #11422 from vbatts/vbatts-overlay_dir_mtime_changes

pkg/archive: ignore mtime changes on directories
This commit is contained in:
Jessie Frazelle 2015-03-23 15:24:05 -07:00
commit 32cd20cfc3
2 changed files with 2 additions and 3 deletions

View file

@ -220,8 +220,8 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) {
oldStat.Gid() != newStat.Gid() || oldStat.Gid() != newStat.Gid() ||
oldStat.Rdev() != newStat.Rdev() || oldStat.Rdev() != newStat.Rdev() ||
// Don't look at size for dirs, its not a good measure of change // Don't look at size for dirs, its not a good measure of change
(oldStat.Size() != newStat.Size() && oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR) || (oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR &&
!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || (!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || (oldStat.Size() != newStat.Size()))) ||
bytes.Compare(oldChild.capability, newChild.capability) != 0 { bytes.Compare(oldChild.capability, newChild.capability) != 0 {
change := Change{ change := Change{
Path: newChild.path(), Path: newChild.path(),

View file

@ -218,7 +218,6 @@ func TestChangesDirsMutated(t *testing.T) {
expectedChanges := []Change{ expectedChanges := []Change{
{"/dir1", ChangeDelete}, {"/dir1", ChangeDelete},
{"/dir2", ChangeModify}, {"/dir2", ChangeModify},
{"/dir3", ChangeModify},
{"/dirnew", ChangeAdd}, {"/dirnew", ChangeAdd},
{"/file1", ChangeDelete}, {"/file1", ChangeDelete},
{"/file2", ChangeModify}, {"/file2", ChangeModify},