@@ -32,15 +32,17 @@ _move-build-to-app() {
32
32
}
33
33
34
34
_select-buildpack () {
35
- local checked_out_path=" $build_path "
36
- # checkout app code if build_path is a bare git repo
37
- if [ -f " $build_path /HEAD" ] && [ -d " $build_path /objects" ]; then
38
- # If bare repo is detected, check out worktree, as expected by buildpacks
39
- tmpdir=$( mktemp -d)
40
- git --git-dir=" $build_path " --work-tree=" $tmpdir " checkout -f & > /dev/null
41
- chown -R " $unprivileged_user :$unprivileged_group " " $tmpdir "
42
- checked_out_path=" $tmpdir "
43
- fi
35
+ local checked_out_path=" $build_path "
36
+ # checkout app code if build_path is a bare git repo
37
+ if [ -f " $build_path /HEAD" ] && [ -d " $build_path /objects" ]; then
38
+ # If bare repo is detected, check out worktree, as expected by buildpacks
39
+ tmpdir=$( mktemp -d)
40
+ git --git-dir=" $build_path " --work-tree=" $tmpdir " checkout -f & > /dev/null
41
+ # unprivileged_user & unprivileged_group defined in outer scope
42
+ # shellcheck disable=SC2154
43
+ chown -R " $unprivileged_user :$unprivileged_group " " $tmpdir "
44
+ checked_out_path=" $tmpdir "
45
+ fi
44
46
if [[ -n " $BUILDPACK_URL " ]]; then
45
47
title " Fetching custom buildpack"
46
48
# buildpack_path defined in outer scope
@@ -79,10 +81,10 @@ _select-buildpack() {
79
81
buildpack_id=" ${buildpack_id#* _buildpack-} "
80
82
81
83
# Output proper JSON
82
- jq -n \
83
- --arg name " $selected_name " \
84
- --arg id " $buildpack_id " \
85
- ' {name: $name, id: $id}'
84
+ jq -n \
85
+ --arg name " $selected_name " \
86
+ --arg id " $buildpack_id " \
87
+ ' {name: $name, id: $id}'
86
88
else
87
89
title " $selected_name app detected"
88
90
fi
@@ -97,11 +99,11 @@ _select-buildpack() {
97
99
}
98
100
99
101
buildpack-detect () {
100
- declare desc=" Detect suitable buildpack for an application"
101
- ensure-paths
102
- [[ " $USER " ]] || randomize-unprivileged
103
- buildpack-setup > /dev/null
104
- _select-buildpack
102
+ declare desc=" Detect suitable buildpack for an application"
103
+ ensure-paths
104
+ [[ " $USER " ]] || randomize-unprivileged
105
+ buildpack-setup > /dev/null
106
+ _select-buildpack
105
107
}
106
108
107
109
buildpack-build () {
0 commit comments