🐛 Fix api-lint-diff to work from a git worktree#2765
Conversation
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>
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Updates the hack/api-lint-diff/run.sh repository-root check so the script works when executed from a Git worktree (where .git is a file rather than a directory), aligning the tool with common local development setups.
Changes:
- Replace the root validation from
[[ ! -d ".git" ]]to[[ ! -e ".git" ]]to support both standard checkouts and worktrees. - Expand the comment to document why existence is checked instead of directory type.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2765 +/- ##
==========================================
- Coverage 66.90% 66.82% -0.08%
==========================================
Files 149 149
Lines 11382 11382
==========================================
- Hits 7615 7606 -9
- Misses 3210 3219 +9
Partials 557 557
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/lgtm It's small enough to have just one reviewer. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rashmigottipati, tmshort The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
8807a64
into
operator-framework:main
Description
hack/api-lint-diff/run.shchecks for the repository root by testing-d ".git". In a git worktree.gitis a file (containing agitdir:pointer), not a directory, so the check always fails with"Must be run from repository root".
This switches the test from
-d(directory) to-e(exists) so itworks in both regular checkouts and worktrees.
Reviewer Checklist