hugofs: Set modTime at creation time

As `ModTime()` should return the same value on each invocation.

See #6161
This commit is contained in:
Bjørn Erik Pedersen 2021-06-05 11:45:56 +02:00
parent 26ae12c0c6
commit 06d295427f
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -265,6 +265,7 @@ func mergeFileMeta(from, to FileMeta) {
type dirNameOnlyFileInfo struct {
name string
modTime time.Time
}
func (fi *dirNameOnlyFileInfo) Name() string {
@ -280,7 +281,7 @@ func (fi *dirNameOnlyFileInfo) Mode() os.FileMode {
}
func (fi *dirNameOnlyFileInfo) ModTime() time.Time {
return time.Now()
return fi.modTime
}
func (fi *dirNameOnlyFileInfo) IsDir() bool {
@ -303,7 +304,7 @@ func newDirNameOnlyFileInfo(name string, meta FileMeta, fileOpener func() (afero
m[metaKeyIsOrdered] = false
return NewFileMetaInfo(
&dirNameOnlyFileInfo{name: base},
&dirNameOnlyFileInfo{name: base, modTime: time.Now()},
m,
)
}