about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xconfig.sh4
-rwxr-xr-xdscip4
2 files changed, 7 insertions, 1 deletions
diff --git a/config.sh b/config.sh
index 1968a92..81eb7f5 100755
--- a/config.sh
+++ b/config.sh
@@ -31,4 +31,6 @@ export DSCIP_DISREGARD_COMMIT_CHECK="false" # If the script should just rebuild
 export DSCIP_OUTPUT_TO="$WORKING_DIRECTORY/output.txt" # Output to file, default is output.txt
 # Automatically update DSCIP?
 export DSCIP_AUTO_UPDATE="false"
-
+# Set up format for the COMMIT_DATE variable. By default, it's %Y%m%d (YEARMONTHDAY | 20220812)
+# See strftime(3) for more information.
+export DSCIP_DATE_FORMAT="%Y%m%d"
diff --git a/dscip b/dscip
index f009fd4..920fd78 100755
--- a/dscip
+++ b/dscip
@@ -90,6 +90,7 @@ build () {
 		echo "DSCIP_FAILED_CMD=$DSCIP_FAILED_CMD";
 		echo "DSCIP_DAEMON=$DSCIP_DAEMON";
 		echo "DSCIP_DAEMON_FORK=$DSCIP_DAEMON_FORK";
+		echo "DSCIP_DATE_FORMAT=$DSCIP_DATE_FORMAT";
 		echo "DSCIP_SLEEP=$DSCIP_SLEEP";
 		echo "DSCIP_DISREGARD_COMMIT_CHECK=$DSCIP_DISREGARD_COMMIT_CHECK";
 		echo "DSCIP_OUTPUT_TO=$DSCIP_OUTPUT_TO"
@@ -149,6 +150,9 @@ run () {
 		return 0
 	fi
 	export CURRENT_COMMIT
+	GIT_UNIX_TIME="$(git show -s --format=%ct "$CURRENT_COMMIT")"
+	COMMIT_DATE="$(date -d "@$GIT_UNIX_TIME" "+$DSCIP_DATE_FORMAT")"
+	export COMMIT_DATE
 
 	# If LAST_COMMIT doesn't exist, that means it's a first run and we can go ahead and build. #
 	# Or skip the commit check if DSCIP_DISREGARD_COMMIT_CHECK is set to true.