Files
uarep-ctl/git-hook.sh
2024-05-03 14:37:16 +03:00

23 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Этот скрипт генерирует модуль с информацией для контроля версий
# 1. В папке ./git/hooks создать файлы:
# - post-checkout
# - post-commit
# - post-merge
# 2. В каждый файл записать строку:
# ./git-hook.sh
# 3. Теперь модуль scripts/commit.gd будет содержать данные
# о текущей версии, после выполнения следующих операций СКВ:
# - переключение ветки;
# - после выполнение фиксации;
# - после выполнения слияния;
GDSCRIPT_FILE="scripts/commit.gd"
HEAD="$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --short HEAD) $(git log -1 --format=%cd)"
echo "extends Node" > ${GDSCRIPT_FILE}
echo "# Файл сгенерирован автоматически! Не изменять вручную!" >> ${GDSCRIPT_FILE}
echo "const VCS_HEAD = '${HEAD}'" >> ${GDSCRIPT_FILE}