@@ -12,6 +12,9 @@ main() {
12
12
# repository to deploy to. must be readable and writable.
13
13
repo=${GIT_DEPLOY_REPO:- origin}
14
14
15
+ # append commit hash to the end of message by default
16
+ append_hash=true
17
+
15
18
# Parse arg flags
16
19
while : ; do
17
20
if [[ $1 = " -v" || $1 = " --verbose" ]]; then
@@ -20,6 +23,12 @@ main() {
20
23
elif [[ $1 = " -e" || $1 = " --allow-empty" ]]; then
21
24
allow_empty=true
22
25
shift
26
+ elif [[ ( $1 = " -m" || $1 = " --message" ) && -n $2 ]]; then
27
+ commit_message=$2
28
+ shift 2
29
+ elif [[ $1 = " -n" || $1 = " --no-hash" ]]; then
30
+ append_hash=false
31
+ shift
23
32
else
24
33
break
25
34
fi
@@ -34,6 +43,17 @@ main() {
34
43
35
44
commit_title=` git log -n 1 --format=" %s" HEAD`
36
45
commit_hash=` git log -n 1 --format=" %H" HEAD`
46
+
47
+ # default commit message uses last title if a custom one is not supplied
48
+ if [[ -z $commit_message ]]; then
49
+ commit_message=" publish: $commit_title "
50
+ fi
51
+
52
+ # append hash to commit message unless no hash flag was found
53
+ if [ $append_hash = true ]; then
54
+ commit_message=" $commit_message " $' \n\n ' " generated from commit $commit_hash "
55
+ fi
56
+
37
57
previous_branch=` git rev-parse --abbrev-ref HEAD`
38
58
39
59
if [ ! -d " $deploy_directory " ]; then
@@ -91,8 +111,7 @@ incremental_deploy() {
91
111
92
112
commit+push () {
93
113
set_user_id
94
- git --work-tree " $deploy_directory " commit -m \
95
- " publish: $commit_title " $' \n\n ' " generated from commit $commit_hash "
114
+ git --work-tree " $deploy_directory " commit -m " $commit_message "
96
115
97
116
disable_expanded_output
98
117
# --quiet is important here to avoid outputting the repo URL, which may contain a secret token
0 commit comments