fix: keep the git directory for worktree-enabled installations

Git worktrees do not include the full .git directory - only a pointer to the actual directory - when keep-git-dir is set to true, which is incorrect for built containers. This change special-cases that combination, allowing folks on newer git installs to actually keep the .git directory during the build process.

Closes #4415
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-20 17:07:52 -05:00
parent 757a829137
commit 3ae9feba8f
4 changed files with 125 additions and 51 deletions

View File

@@ -71,3 +71,35 @@ teardown() {
echo "status: $status"
assert_output_exists
}
@test "(git) keep-git-dir" {
run /bin/bash -c "dokku git:set $TEST_APP keep-git-dir true"
echo "output: $output"
echo "status: $status"
assert_success
run deploy_app
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku enter $TEST_APP web ls .git"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "branches"
assert_output_contains "config"
assert_output_contains "description"
assert_output_contains "HEAD"
assert_output_contains "hooks"
assert_output_contains "index"
assert_output_contains "info"
assert_output_contains "logs"
assert_output_contains "objects"
assert_output_contains "refs"
run /bin/bash -c "dokku enter $TEST_APP web test -d .git"
echo "output: $output"
echo "status: $status"
assert_success
}