File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ should_use_file_from_github_url=true
34# defaults
45PLACEHOLDER_REGEX_COMMIT_ISSUE_NUMBER=" ^\s*[\-\w]*\d:"
56PLACEHOLDER_REGEX_BRANCH_ISSUE_NUMBER=" [.]*\/([\-\w]*?\-\d+)"
67PLACEHOLDER_REGEX_GIT_COMMIT_MESSAGES=" (Merge\sbranch\s\'|\#\sRebase\s|This\sreverts\scommit\s)"
78PLACEHOLDER_LOGGING_VERBOSE=" true"
89PLACEHOLDER_NEW_COMMIT_MESSAGE=" #{issue_number.upcase}: #{original_commit_message.gsub(/(\s[[:punct:]])+$/, '')}"
10+ GITHUB_SCRIPT_URL=" https://raw.githubusercontent.com/yrave/prepare-commit-msg/master/scripts/prepare-commit-msg"
911
1012PATH_GIT_GLOBAL=" ${HOME} /.git-template/"
1113PATH_GIT_LOCAL=" ./.git/"
@@ -139,10 +141,14 @@ else
139141 HOOK_FILE=" ${PATH_GIT_LOCAL}${HOOK_DIR}${HOOK_NAME} "
140142fi
141143
142- printf -- " - Creating git hook file\n"
143-
144- BASEDIR=$( dirname $0 )
145- cat " ${BASEDIR} /prepare-commit-msg" > " $HOOK_FILE "
144+ if [ " $should_use_file_from_github_url " = true ] ; then
145+ printf -- " - Downloading git hook...\n"
146+ curl -s " $GITHUB_SCRIPT_URL " > " $HOOK_FILE "
147+ else
148+ printf -- " - Creating git hook file from local file\n"
149+ BASEDIR=$( dirname $0 )
150+ cat " ${BASEDIR} /prepare-commit-msg" > " $HOOK_FILE "
151+ fi
146152
147153printf -- " - Replacing placeholders...\n"
148154PLACEHOLDER_REGEX_COMMIT_ISSUE_NUMBER=$( printf -- " $PLACEHOLDER_REGEX_COMMIT_ISSUE_NUMBER " | sed ' s/\\/\\\\/g' )
You can’t perform that action at this time.
0 commit comments