From 318d603c51a730a9d55f0f44b2ffff5874cfb5cb Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sun, 15 Oct 2023 23:29:19 +0200 Subject: [PATCH] fixup the timestamp-sourcing script --- scripts/source-timestamps.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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