Skip to content

Commit 8807a64

Browse files
pedjakclaude
andauthored
fix: allow api-lint-diff to run from a git worktree (#2765)
In a git worktree `.git` is a file (not a directory), so the `-d` test always fails. Switch to `-e` which checks for existence regardless of type. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 90a99bf commit 8807a64

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

hack/api-lint-diff/run.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ cleanup() {
3030

3131
trap cleanup EXIT
3232

33-
# Ensure we're in the repository root
34-
if [[ ! -d ".git" ]]; then
33+
# Ensure we're in the repository root (.git is a directory in a regular
34+
# checkout but a file in a worktree, so test existence rather than type)
35+
if [[ ! -e ".git" ]]; then
3536
echo -e "${RED}Error: Must be run from repository root${NC}"
3637
exit 1
3738
fi

0 commit comments

Comments
 (0)