Commit b517b45
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>1 parent ef4ec84 commit b517b45
1 file changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
422 | 445 | | |
423 | 446 | | |
424 | 447 | | |
| |||
0 commit comments