File tree 2 files changed +7
-10
lines changed
2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 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
7
2
8
3
# Changing plugin version before commit
9
- pwd
10
4
echo " Change version"
11
5
$( git config core.editor) version.cfg && { git add version.cfg && exit 0; }
12
6
exit 1
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ # This hook appends commit type and hash of commit if possible (on --amend)
4
+ # Needs moreutils package
5
+
3
6
FILEPATH=$1
4
7
5
8
TYPE=" None"
6
9
[ " $2 " != " " ] && TYPE=$2
7
10
8
11
HASH=" "
9
- [ " $3 " != " " ] && HASH=$3
12
+ [ " $3 " != " " ] && HASH=$( git rev-parse $3 | head -c8 )
10
13
11
14
HASH_MSG=" "
12
- [ HASH != " " ] && HASH_MSG=" Previous commit hash: ${HASH} "
15
+ [ " $ HASH" != " " ] && HASH_MSG=" Previous commit hash: ${HASH} \n "
13
16
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
You can’t perform that action at this time.
0 commit comments