mirror of
https://github.com/NotXia/unibo-ai-notes.git
synced 2025-12-16 11:31:49 +01:00
Update hash extraction
This commit is contained in:
2
.github/workflows/compile.yml
vendored
2
.github/workflows/compile.yml
vendored
@ -4,7 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths: ["src/**", .github/workflows/**]
|
paths: ["src/**", .github/workflows/**, ./compile.sh]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
compile:
|
compile:
|
||||||
|
|||||||
16
compile.sh
16
compile.sh
@ -11,7 +11,7 @@ if [ $# -eq 0 ]; then
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shopt -s globstar
|
shopt -s globstar extglob
|
||||||
|
|
||||||
out_dir=`realpath $1`
|
out_dir=`realpath $1`
|
||||||
old_out_dir=`realpath $2`
|
old_out_dir=`realpath $2`
|
||||||
@ -28,12 +28,18 @@ getDirLastHash () {
|
|||||||
echo `awk -F"," "\\$1 == \"$path\" { print \\$2 } " $hash_file`
|
echo `awk -F"," "\\$1 == \"$path\" { print \\$2 } " $hash_file`
|
||||||
}
|
}
|
||||||
|
|
||||||
updateHashes() {
|
# $1: path of the directory
|
||||||
|
getDirCurrHash () {
|
||||||
|
path="$1"
|
||||||
|
echo `git log -n 1 --format='%h' $path/**/*.!(cls)`
|
||||||
|
}
|
||||||
|
|
||||||
|
updateHashes () {
|
||||||
cd $work_dir
|
cd $work_dir
|
||||||
echo "ainotes.cls,`git log -n 1 --format='%h' ./ainotes.cls`" > $new_hash_file
|
echo "ainotes.cls,`git log -n 1 --format='%h' ./ainotes.cls`" > $new_hash_file
|
||||||
for f in **/[!_]*.tex; do
|
for f in **/[!_]*.tex; do
|
||||||
f_dir=$(dirname $f)
|
f_dir=$(dirname $f)
|
||||||
echo "$f_dir,`git log -n 1 --format='%h' $f_dir`" >> $new_hash_file
|
echo "$f_dir,`getDirCurrHash $f_dir`" >> $new_hash_file
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +54,7 @@ for f in **/[!_]*.tex; do
|
|||||||
f_base=$(basename $f)
|
f_base=$(basename $f)
|
||||||
f_nameonly="${f_base%.*}"
|
f_nameonly="${f_base%.*}"
|
||||||
old_hash=`getDirLastHash "$f_dir"`
|
old_hash=`getDirLastHash "$f_dir"`
|
||||||
curr_hash="$(git log -n 1 --format='%h' $f_dir)"
|
curr_hash=`getDirCurrHash "$f_dir"`
|
||||||
|
|
||||||
mkdir -p $out_dir/$f_dir
|
mkdir -p $out_dir/$f_dir
|
||||||
|
|
||||||
@ -62,7 +68,7 @@ for f in **/[!_]*.tex; do
|
|||||||
cd ${f_dir};
|
cd ${f_dir};
|
||||||
|
|
||||||
# Insert last update date
|
# Insert last update date
|
||||||
last_update=$(LC_ALL="en_GB.UTF-8" git log -1 --pretty="format:%ad" --date="format:%d %B %Y" .)
|
last_update=`LC_ALL="en_GB.UTF-8" git log -1 --pretty="format:%ad" --date="format:%d %B %Y" ./**/*.!(cls)`
|
||||||
cp --remove-destination $(readlink ainotes.cls) ainotes.cls
|
cp --remove-destination $(readlink ainotes.cls) ainotes.cls
|
||||||
sed -i "s/PLACEHOLDER-LAST-UPDATE/${last_update}/" ainotes.cls
|
sed -i "s/PLACEHOLDER-LAST-UPDATE/${last_update}/" ainotes.cls
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user