summaryrefslogtreecommitdiff
path: root/scripts/snapstamp
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/snapstamp')
-rwxr-xr-xscripts/snapstamp20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/snapstamp b/scripts/snapstamp
new file mode 100755
index 0000000..4e037e0
--- /dev/null
+++ b/scripts/snapstamp
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Emit a snapshot identifier if STP_BUILD_SNAPSHOT is set
+#
+# Copyright (C) 2019 Robert Krawitz
+#
+# 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 2, 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, see <https://www.gnu.org/licenses/>.
+
+[[ -n $STP_BUILD_SNAPSHOT && -d .git ]] && printf '%s%(%Y-%m-%dT%H-%M)T-%s' - -1 $(git describe --dirty --always --first-parent --exclude '*')