From 87dc34ab660fe91d3e77bde7548a9c6d05d28f03 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 31 Jul 2023 09:34:25 +0200 Subject: Don’t print an error if there is no commit yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When working on a new file, I like to auto-compile my changes with: $ git ls-files | entr make But since footer generation fails due to no commit existing, date(1) screams at me. This should fix that issue. --- include/footer.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/footer.html b/include/footer.html index 9557e17..e3235e1 100644 --- a/include/footer.html +++ b/include/footer.html @@ -7,7 +7,8 @@ m4_define(`m4___id__', m4_esyscmd(git rev-list -1 HEAD m4___caller__)) > m4_esyscmd( git log -1 --pretty='format:%cI' m4___caller__ \ - | xargs date +'%A %d %B %Y — %T %Z' -d + | ifne xargs date +'%A %d %B %Y — %T %Z' -d \ + | ifne -n echo 'No commit yet…' ) -- cgit v1.2.3