customer_281/.githooks/post-checkout

21 lines
685 B
Plaintext
Raw Normal View History

2023-04-12 14:22:17 +02:00
echo "POST-CHECKOUT"
echo "PREV-HEAD=$1"
echo "CURR-HEAD=$2"
echo "BRANCH-CHECKOUT=$3"
2023-05-25 14:51:42 +02:00
readonly ch_file="/opt/app/tools/atbupdate/checkout_history"
readonly update_log_file="/opt/app/tools/atbupdate/update_log.csv"
if [ -f $ch_file ]; then
readonly repo=$(basename $(git rev-parse --show-toplevel))
2023-05-25 14:33:48 +02:00
readonly branch=$(git log --graph --all --decorate $2 | head -n 1 | sed -E -e 's/(.*?)(\(.*\))/\2/g')
2023-05-25 14:51:42 +02:00
line="$repo:$branch"
2023-05-25 15:08:21 +02:00
echo "line=$line"
if ! grep -Eq "$line" $ch_file; then
2023-05-25 14:51:42 +02:00
echo $line >> $ch_file
2023-05-25 14:54:59 +02:00
echo "DOWNLOAD, /etc/dc/dc2c.4.21.bin, $(date +%Y-%m-%dT%T), N/A" >> $update_log_file
2023-05-25 15:04:51 +02:00
else
echo "Found $line. Do nothing"
2023-05-25 14:51:42 +02:00
fi
2023-05-25 14:33:48 +02:00
fi