Skip to content

Commit 3ac57a0

Browse files
author
Vano
committed
pre-commit fix + comments
1 parent 338fce6 commit 3ac57a0

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

pre-commit

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
# Called by "git commit" with no arguments. The hook should
2-
# exit with non-zero status after issuing an appropriate message if
3-
# it wants to stop the commit.
4-
#
5-
# To enable this hook, rename this file to "pre-commit".
6-
#
1+
#!/bin/bash
72

83
# Changing plugin version before commit
9-
pwd
104
echo "Change version"
115
$(git config core.editor) version.cfg && { git add version.cfg && exit 0;}
126
exit 1

prepare-commit-msg

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/bin/bash
22

3+
# This hook appends commit type and hash of commit if possible (on --amend)
4+
# Needs moreutils package
5+
36
FILEPATH=$1
47

58
TYPE="None"
69
[ "$2" != "" ] && TYPE=$2
710

811
HASH=""
9-
[ "$3" != "" ] && HASH=$3
12+
[ "$3" != "" ] && HASH=$(git rev-parse $3 | head -c8)
1013

1114
HASH_MSG=""
12-
[ HASH != "" ] && HASH_MSG="Previous commit hash: ${HASH}"
15+
[ "$HASH" != "" ] && HASH_MSG="Previous commit hash: ${HASH}\n"
1316

14-
cat <(printf "Commit type: %s\n%s\n" "$TYPE" "$HASH_MSG") $FILEPATH | tee 1>/dev/null $FILEPATH
17+
cat <(printf "Commit type: %s\n%s" "$TYPE" "$HASH" "$HASH_MSG") $FILEPATH | sponge $FILEPATH

0 commit comments

Comments
 (0)