From 8ea4850bf66bd145d12d3b6f2bcce4b14a93a555 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 23 Sep 2013 10:58:56 -0700 Subject: [PATCH] dist: 'make set-timestamps' cleanup * Makefile (set-timestamps): Use git's tformat rather than format, to port to strict POSIX hosts where `` output in shell scripts cannot end in a non-newline. Use git diff --quiet rather than git diff --name-only, as it's simpler. Use touch -c for safety, and -m to avoid setting last-access time, which we don't care about. Diagnose files that don't match repository. * NEWS: Document this. --- Makefile | 15 ++++++++------- NEWS | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5633a1d..5bd3d9c 100644 --- a/Makefile +++ b/Makefile @@ -472,16 +472,17 @@ public: check check_public check_time_t_alternatives \ # and if the files have not changed since then. # This uses GNU 'touch' syntax 'touch -d@N FILE', # where N is the number of seconds since 1970. -# If git or GNU 'touch' is absent, do nothing. +# If git or GNU 'touch' is absent, do nothing and fail. set-timestamps: - -TZ=UTC0 && export TZ && files=`git ls-files` && \ + -files=`git ls-files` && \ touch -d @1 test.out && rm -f test.out && \ for file in $$files; do \ - test -z "`git diff --name-only $$file`" || continue; \ - cmd="touch -d @`git log -1 --format='format:%ct' $$file \ - ` $$file" && \ - echo "$$cmd" && \ - $$cmd || exit; \ + if git diff --quiet $$file; then \ + time=`git log -1 --format='tformat:%ct' $$file` && \ + touch -cmd @$$time $$file; \ + else \ + echo >&2 "$$file: warning: does not match repository"; \ + fi || exit; \ done # The zics below ensure that each data file can stand on its own. diff --git a/NEWS b/NEWS index 2f8c3e0..e3488bf 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,8 @@ Unreleased, experimental changes done differently, and tags would either not have a simple name or not exactly match what was released. + 'make set-timestamps' is now simpler and a bit more portable. + Release 2013e - 2013-09-19 23:50:04 -0700