Skip to content

Commit 0af7e6d

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 f61a87e commit 0af7e6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ 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+
wdirgitindex="$(git rev-parse --git-dir 2>&1)/index" || echo_error_and_exit "${wdirgitindex%/index}"
4343
if ! su-exec "$USERID" "$BASHPATH" -c "test -w $wdirgitindex && test -r $wdirgitindex"; then
4444
echo_error_and_exit "uid:gid $USERID cannot write to $wdirgitindex"
4545
fi

0 commit comments

Comments
 (0)