[tz] [PATCH] Port better to POSIX 'touch'

Paul Eggert eggert at cs.ucla.edu
Mon Jul 24 19:45:01 UTC 2023


* Makefile (set-timestamps.out): Use POSIX syntax for 'touch -d'
rather than relying on a GNU extension.
---
 Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 17e73891..d891f837 100644
--- a/Makefile
+++ b/Makefile
@@ -988,8 +988,11 @@ set-timestamps.out: $(EIGHT_YARDS)
 		  rm -f test.out && \
 		  for file in $$files; do \
 		    if git diff --quiet $$file; then \
-		      time=`git log -1 --format='tformat:%ct' $$file` && \
-		      touch -cmd @$$time $$file; \
+		      time=`TZ=UTC0 git log -1 \
+			--format='tformat:%cd' \
+			--date='format:%Y-%m-%dT%H:%M:%SZ' \
+			$$file` && \
+		      touch -cmd $$time $$file; \
 		    else \
 		      echo >&2 "$$file: warning: does not match repository"; \
 		    fi || exit; \
-- 
2.39.2



More information about the tz mailing list