Skip to content

Commit 1576f8c

Browse files
committed
installer for pre-commit script
1 parent 4d7c1df commit 1576f8c

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

misc/force-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.12-dev
1+
3.7.12-dev:::2024-05-17_16:44:44

pre-commit

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
#
3+
# An example hook script to verify what is about to be committed.
4+
# Called by "git commit" with no arguments. The hook should
5+
# exit with non-zero status after issuing an appropriate message if
6+
# it wants to stop the commit.
7+
#
8+
# To enable this hook, rename this file to "pre-commit".
9+
10+
if [ $# -eq 1 ] && [ "$1" == "install" ]; then
11+
cp "$0" -t .git/hooks/
12+
exit 0
13+
fi
14+
15+
FILE="misc/force-version.txt"
16+
17+
if ! grep 'dev' "$FILE" &> /dev/null; then
18+
exit 0
19+
fi
20+
21+
VERSION=$(sed -E 's/:::.*//' "$FILE")
22+
TIME=$(date +"%Y-%m-%d_%H:%M:%S")
23+
24+
printf "%s:::%s\n" "$VERSION" "$TIME" > "$FILE"
25+
26+
git add "$FILE"

0 commit comments

Comments
 (0)