diff --git a/plugins/apps/subcommands/clone b/plugins/apps/subcommands/clone index 7ba17a6a9..e4fde7cc7 100755 --- a/plugins/apps/subcommands/clone +++ b/plugins/apps/subcommands/clone @@ -49,7 +49,6 @@ cmd-apps-clone() { fi rm -rf "$NEW_CACHE_DIR" - [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" [[ "$SKIP_REBUILD" == "true" ]] || ps_rebuild "$NEW_APP" plugn trigger post-app-clone "$OLD_APP" "$NEW_APP" dokku_log_info1_quiet "Cloning $OLD_APP to $NEW_APP... done" diff --git a/plugins/git/post-app-clone-setup b/plugins/git/post-app-clone-setup new file mode 100755 index 000000000..68fda4efb --- /dev/null +++ b/plugins/git/post-app-clone-setup @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +trigger-git-post-app-clone-setup() { + declare desc="modifies git-hook" + declare trigger="post-app-clone-setup" + declare OLD_APP="$1" NEW_APP="$2" + + [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" +} + +trigger-git-post-app-clone-setup "$@"