fixup the timestamp-sourcing script
This commit is contained in:
parent
32529c8c0f
commit
318d603c51
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue