File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -31,17 +31,21 @@ debug() {
3131 fi
3232}
3333
34+ # Return the sorted list of files comprising a git-hook pipeline.
3435_getPipeline () {
3536 searchDir=$1 ; shift
3637 find " ${searchDir} " \
3738 -regex " .*/[0-9]\{3\}+\{0,1\}.*" \
3839 | sort
3940}
4041
42+ # Test if the supplied script is classified as a "ensured" script.
4143_ensuredScript () {
4244 [ -z " $( echo " ${script} " | sed -ne ' /[0-9]\{3\}+/p' ) " ]
4345}
4446
47+ # Given the existing exit-code ($1) and the exit-code of the last
48+ # script that ran ($2), return the new exit-code for this pipeline.
4549_updateRc () {
4650 if [[ $1 -eq 0 ]]; then
4751 echo " $2 "
@@ -50,11 +54,17 @@ _updateRc() {
5054 fi
5155}
5256
57+ # Test if this pipeline is in short-circuit mode, given the current
58+ # pipeline's exit-code.
5359_shortCircuit () {
5460 local -r rc=$1 ; shift
5561 [ " ${rc} " -le 0 ]
5662}
5763
64+ # Determine the exit code for the entire pipeline.
65+ #
66+ # Note: this function should be called at the end of a pipeline's
67+ # execution.
5868_determineExitCode () {
5969 local -r rc=$1 ; shift
6070 # negative exit codes indicate a short-circuit without failure
@@ -65,6 +75,8 @@ _determineExitCode() {
6575 fi
6676}
6777
78+ # This method is called by captain-hook. It will run the user's
79+ # defined git-hook pipeline when a client-side hook is invoked by git.
6880runHook () {
6981 local -r hook=$1 ; shift
7082 local rc=0
You can’t perform that action at this time.
0 commit comments