diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-08-05 15:09:09 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-08-05 17:00:19 +0300 |
commit | d9f66f00a5898b4a3cf2ea8ada9a2d08f34c670e (patch) | |
tree | 460752d8e864237774947a3515bcb35435b3dc2e /src/util.rs | |
parent | fe85456490c4f297dbd9b773cf5c3b8c6b053c42 (diff) | |
download | riki-d9f66f00a5898b4a3cf2ea8ada9a2d08f34c670e.tar.gz |
feat: set file commit time to git commit timestamp, unless changed
If a file is committed to git and hasn't been changed, use the latest
commit time for the file as the timestamp of the output file.
This lacks tests, as I find it too much of a bother to set up git
histories with timestamps.
Sponsored-by: author
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs index 1f69523..7909080 100644 --- a/src/util.rs +++ b/src/util.rs @@ -34,6 +34,8 @@ pub fn get_mtime(src: &Path) -> Result<SystemTime, SiteError> { } pub fn set_mtime(filename: &Path, mtime: SystemTime) -> Result<(), SiteError> { + trace!("set_mtime: filename={} mtime={:?}", filename.display(), mtime); + let mtime = timespec(mtime)?; let times = [mtime, mtime]; let times: *const timespec = ×[0]; |