Skip to content

Commit

Permalink
fix: Honor SOURCE_DATE_EPOCH for files
Browse files Browse the repository at this point in the history
If set, SOURCE_DATE_EPOCH will be honored for all content entries.
  • Loading branch information
osm committed Jan 29, 2024
1 parent fbc55c5 commit 6eabe06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (c *Content) WithFileInfoDefaults(umask fs.FileMode, mtime time.Time) *Cont
if (cc.Type == TypeDir || cc.Type == TypeImplicitDir) && cc.FileInfo.Mode == 0 {
cc.FileInfo.Mode = 0o755
}
if (cc.Type == TypeDir || cc.Type == TypeImplicitDir) && cc.FileInfo.MTime.IsZero() {
if cc.FileInfo.MTime.IsZero() {
cc.FileInfo.MTime = mtime
}

Expand Down
2 changes: 1 addition & 1 deletion files/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ contents:
require.Equal(t, "files_test.go", f.Source)
require.Equal(t, "/b", f.Destination)
require.Equal(t, f.FileInfo.Mode, fi.Mode())
require.Equal(t, f.FileInfo.MTime, fi.ModTime())
require.Equal(t, f.FileInfo.MTime, mtime)
}

func TestFileInfo(t *testing.T) {
Expand Down

0 comments on commit 6eabe06

Please sign in to comment.