Skip to content

Commit d9ed1e0

Browse files
committed
Fix edge case: app directory is created before first app push
When an app directory (i.e. `/home/dokku/myapp`) is created before the app is pushed for the first time (which may occur if config files such as `ENV` are added before the initial push), then the app directory will not be initialized to a bare git repo nor will the pre-receive hook be installed because `plugins/git/commands` assumes that if `$APP_PATH` exists, then the directory must also be git initialized too. This fix checks for `$APP_PATH/refs` instead.
1 parent 3ee694d commit d9ed1e0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎plugins/git/commands‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ case "$1" in
2323
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
2424
APP_PATH=$DOKKU_ROOT/$APP
2525

26-
if [[ $1 == "git-receive-pack" && ! -d $APP_PATH ]]; then
26+
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
2727
git init --bare $APP_PATH > /dev/null
2828
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
2929
cat > $PRERECEIVE_HOOK <<EOF

0 commit comments

Comments
 (0)