Repository: goreleaser/nfpm
Pull request #775 (2024-01-29 19:21:16)

fix: Honor SOURCE_DATE_EPOCH for files
If set, SOURCE_DATE_EPOCH will be honored for all content entries.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/goreleaser/nfpm/pull/775?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`fbc55c5`)](https://app.codecov.io/gh/goreleaser/nfpm/commit/fbc55c56be14ac5de4207becb98c908c615dee7e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) 75.15% compared to head [(`6eabe06`)](https://app.codecov.io/gh/goreleaser/nfpm/pull/775?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) 75.15%.


<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #775   +/-   ##
=======================================
  Coverage   75.15%   75.15%           
=======================================
  Files          13       13           
  Lines        2475     2475           
=======================================
  Hits         1860     1860           
  Misses        435      435           
  Partials      180      180           
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/goreleaser/nfpm/pull/775?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).


Patch:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 50324b7..8ccf43d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -35,7 +35,7 @@ jobs:
         with:
           repo-token: ${{ secrets.GITHUB_TOKEN }}
       - uses: sigstore/cosign-installer@v3.3.0
-      - uses: anchore/sbom-action/download-syft@v0.15.5
+      - uses: anchore/sbom-action/download-syft@v0.15.6
       - uses: docker/setup-qemu-action@v3
       - uses: docker/setup-buildx-action@v3
       - uses: cachix/install-nix-action@v25
diff --git a/files/files.go b/files/files.go
index 7c0d3ac..c8f462a 100644
--- a/files/files.go
+++ b/files/files.go
@@ -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
 	}
 


Test patch:
diff --git a/files/files_test.go b/files/files_test.go
index 3f02505..d6c45dc 100644
--- a/files/files_test.go
+++ b/files/files_test.go
@@ -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) {