Merge pull request #2500 from dokku/2479-jg-suppress-output-on-submodule-success
Suppress output unless the `git submodule update` call fails
This commit is contained in:
@@ -28,7 +28,7 @@ git_build_app_repo() {
|
|||||||
git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null
|
git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null
|
||||||
git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null
|
git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null
|
||||||
git reset --hard FETCH_HEAD &> /dev/null
|
git reset --hard FETCH_HEAD &> /dev/null
|
||||||
git submodule update --init --recursive &> /dev/null
|
suppress_output git submodule update --init --recursive
|
||||||
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
|
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
|
||||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||||
|
|
||||||
@@ -41,6 +41,20 @@ git_build_app_repo() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suppress_output() {
|
||||||
|
declare desc="suppress all output from a given command unless there is an error"
|
||||||
|
local TMP_COMMAND_OUTPUT
|
||||||
|
TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
|
||||||
|
trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT
|
||||||
|
|
||||||
|
"$@" > "$TMP_COMMAND_OUTPUT" 2>&1 || {
|
||||||
|
local exit_code="$?"
|
||||||
|
cat "$TMP_COMMAND_OUTPUT"
|
||||||
|
return "$exit_code"
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
git_hook_cmd() {
|
git_hook_cmd() {
|
||||||
declare desc="kick off receive-app trigger from git prereceive hook"
|
declare desc="kick off receive-app trigger from git prereceive hook"
|
||||||
local cmd="git-hook"
|
local cmd="git-hook"
|
||||||
|
|||||||
Reference in New Issue
Block a user