24 lines
1.2 KiB
Markdown
24 lines
1.2 KiB
Markdown
---
|
|
name: Sync script bug — untracked files
|
|
description: Flagged for Mike — .claude/scripts/sync.sh misses untracked-only changes
|
|
type: project
|
|
---
|
|
|
|
`.claude/scripts/sync.sh` line 53 uses `git diff-index --quiet HEAD --` to detect local changes. This only flags **tracked** files with modifications. Brand-new untracked files (a new report, new session log, new memory) will NOT be detected on their own — they only get swept up when a tracked file is also dirty (because `git add -A` then runs).
|
|
|
|
Symptom seen 2026-04-17 by Howard: added a single new report file, ran /sync, script said "No local changes to commit" and did nothing. Workaround was `git add <file>` first, then re-run.
|
|
|
|
**Why:** `git diff-index` ignores untracked files by design. Needs `git status --porcelain` (any output = changes) or equivalent.
|
|
|
|
**How to apply:** Mike — small one-line fix in `.claude/scripts/sync.sh`. Suggested replacement:
|
|
|
|
```bash
|
|
# Before (line 53):
|
|
if ! git diff-index --quiet HEAD -- 2>/dev/null; then
|
|
|
|
# After:
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
```
|
|
|
|
Also applies to the Sync Summary's `git diff --stat $LOCAL_BEFORE..HEAD` — may need review to make sure the summary range still makes sense after the detection fix.
|