fix: ensure the pre-receive hook and URLS files are correct when cloning or renaming apps
Closes #8035
This commit is contained in:
@@ -8,15 +8,15 @@ trigger-git-post-app-clone-setup() {
|
||||
declare trigger="post-app-clone-setup"
|
||||
declare OLD_APP="$1" NEW_APP="$2"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]]; then
|
||||
sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
fi
|
||||
|
||||
fn-plugin-property-clone "git" "$OLD_APP" "$NEW_APP"
|
||||
|
||||
pushd "$DOKKU_ROOT/$OLD_APP/." >/dev/null
|
||||
find ./* \( -name ".cache" -o -name "cache" -o -name "VHOST" \) -prune -o -print | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||
find ./* \( -name ".cache" -o -name "cache" -o -name "VHOST" -o -name "URLS" \) -prune -o -print | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||
popd &>/dev/null || pushd "/tmp" >/dev/null
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]]; then
|
||||
sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
fi
|
||||
}
|
||||
|
||||
trigger-git-post-app-clone-setup "$@"
|
||||
|
||||
@@ -8,16 +8,16 @@ trigger-git-post-app-rename-setup() {
|
||||
declare trigger="post-app-rename-setup"
|
||||
declare OLD_APP="$1" NEW_APP="$2"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]]; then
|
||||
sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
fi
|
||||
|
||||
fn-plugin-property-clone "git" "$OLD_APP" "$NEW_APP"
|
||||
fn-plugin-property-destroy "git" "$OLD_APP"
|
||||
|
||||
pushd "$DOKKU_ROOT/$OLD_APP/." >/dev/null
|
||||
find ./* \( -name ".cache" -o -name "cache" -o -name "VHOST" \) -prune -o -print | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||
find ./* \( -name ".cache" -o -name "cache" -o -name "VHOST" -o -name "URLS" \) -prune -o -print | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||
popd &>/dev/null || pushd "/tmp" >/dev/null
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]]; then
|
||||
sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
fi
|
||||
}
|
||||
|
||||
trigger-git-post-app-rename-setup "$@"
|
||||
|
||||
Reference in New Issue
Block a user