Fix gitAdd to skip staging files ignored by .gitignore (#2707)
## Summary
- Add a pre-flight check in `gitAdd` to detect if a file is ignored by
`.gitignore` before attempting to stage it
- Skip staging ignored files gracefully with a debug log instead of
throwing an error
- This prevents errors when the AI attempts to stage files like
`.env.local` that should remain untracked
## Test plan
- [ ] Verify that staging a normal file still works correctly
- [ ] Create a `.gitignore` file that ignores a test file (e.g.,
`test.ignored`)
- [ ] Create the ignored file and attempt to stage it
- [ ] Confirm the file is skipped without error and a debug message is
logged
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2707"
target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<!-- devin-review-badge-end -->
---------
Co-authored-by:
Will Chen <willchen90@gmail.com>
Co-authored-by:
Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by:
claude[bot] <41898282+claude[bot]@users.noreply.github.com>
正在显示
请
注册
或者
登录
后发表评论