diff --git a/scripts/source-timestamps.sh b/scripts/source-timestamps.sh index 5bce4de..ce30cf9 100755 --- a/scripts/source-timestamps.sh +++ b/scripts/source-timestamps.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (C) 2023 University of Luxembourg @@ -30,13 +30,13 @@ do find "$1" -type f -name '*.md' | grep -v "$NOT_SOURCE_REGEX" | while read file ; do fn=`basename "$file"` dir=`dirname "$file"` - tsfn="$fn.timestamp" + outfn="$fn.metadata.yml" ( - echo "making timestamp in '$dir' for file '$fn' ..." >> "$LOGFILE" + echo "adding timestamp in '$dir' for file '$fn' ..." >> "$LOGFILE" cd "$dir" - if [ -f "$tsfn" ] + if grep -q -s "^timestamp:" "$outfn" then echo "... but it already exists; skipping!" >> "$LOGFILE" - else git log -n 1 --pretty=format:%cs -- "$fn" > "$tsfn" + else git log -n 1 --pretty=format:$'timestamp: %cs\n' -- "$fn" >> "$outfn" fi ) done