Skip to content

Commit 3c9551b

Browse files
committed
fix(docker): wdirgitindex from git rev-parse --git-dir
Get `wdirgitindex` from $(git rev-parse --git-dir) to make it correct for non-worktree repos, and for worktree repos in either the main worktree or linked worktree
1 parent c949dd2 commit 3c9551b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ wdir="$(pwd)"
3939
if ! su-exec "$USERID" "$BASHPATH" -c "test -w $wdir && test -r $wdir"; then
4040
echo_error_and_exit "uid:gid $USERID lacks permissions to $wdir/"
4141
fi
42-
wdirgitindex="$wdir/.git/index"
42+
wdirgitdir="$(git rev-parse --git-dir)" || echo_error_and_exit "Cannot determine Git directory"
43+
wdirgitindex="${wdirgitdir}/index"
4344
if ! su-exec "$USERID" "$BASHPATH" -c "test -w $wdirgitindex && test -r $wdirgitindex"; then
4445
echo_error_and_exit "uid:gid $USERID cannot write to $wdirgitindex"
4546
fi

0 commit comments

Comments
 (0)