mkgitrel.setprev: factor out helper scripts, extend it
[releases.git] / mkgitrel.setdate
diff --git a/mkgitrel.setdate b/mkgitrel.setdate
new file mode 100644 (file)
index 0000000..3ecf9b7
--- /dev/null
@@ -0,0 +1,28 @@
+#! /bin/bash
+
+# Copyright 2021-2022 Alexandre Oliva <lxoliva@fsfla.org>
+#
+# This program is part of GNU Linux-libre, a GNU project that
+# publishes scripts to clean up Linux so as to make it suitable for
+# use in the GNU Project and in Free System Distributions.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+# USA
+
+DATE=$(git cat-file -p incr/v$rel |
+       gawk '/^(author|tagger)/ {
+               print strftime(PROCINFO["strftime"], $(NF-1))
+             }') &&
+export GIT_COMMITTER_DATE=$DATE GIT_AUTHOR_DATE=$DATE