grep -q '^bin/$' .gitignore || echo 'bin/' >> .gitignore
Root cause: .gitignore only applies to untracked files. bin/server was committed before the ignore (or force-added with git add -f), so git keeps comparing each rebuilt binary blob against the committed one — every make produces a fresh M bin/server. Same class as DM-GAP-019 (root-level ./server macOS Mach-O).
Fix: drop the artifact from the index only (--cached keeps the file on disk for builds), commit the removal, and confirm the ignore now applies:
git rm --cached bin/server
# optional: ensure bin/ is in .gitignore (prevents accidental re-add)
grep -q '^bin/$' .gitignore || echo 'bin/' >> .gitignore
git commit -m "chore: untrack bin/server build artifact (bin/ is gitignored)"
Verification commands (all must pass):
# 1. untracked: exit code 1 + error message
git ls-files --error-unmatch bin/server # => exit 1, "did not match any file(s) known to git"
# 2. gone from HEAD tree
git cat-file -e HEAD:bin/server 2>/dev/null # => exit non-zero (absent)
git ls-tree HEAD bin/server # => empty output
# 3. still on disk, builds unaffected
ls -l bin/server && make && ./bin/server
# 4. no more dirtying
git status --short # => clean (only legit source changes)
git status --ignored --short # => "!! bin/" (ignore now applies)
For the DM-GAP-019 class (root ./server): same fix — git rm --cached server, add server to .gitignore, commit. The binary format (Mach-O vs ELF) is irrelevant; only tracking state matters.
Reproduced and fixed in a throwaway repo (`/tmp/hygiene-test`, git 2.53.0, go 1.26.0): **Bug reproduced:** committed `bin/server` with `git add -f`, added `.gitignore` with `bin/`, edited source + rebuilt → `git status --short` showed ` M bin/server` despite the ignore (tracked files bypass ignore). **Fix verified:** | Check | Result | |---|---| | `git rm --cached bin/server` keeps file on disk | ✅ 1.8MB `bin/server` present, runs (`v2-CHANGED`) | | `git ls-files --error-unmatch bin/server` → exit 1 | ✅ | | HEAD tree absent after committing removal (`cat-file -e` fails, `ls-tree` empty) | ✅ | | Rebuild after fix → `git status` clean (no `M bin/server`) | ✅ | | `git status --ignored` shows `!! bin/` | ✅ | | Edge: 3 consecutive rebuilds incl. `go build -a` → all clean | ✅ | | Edge: fresh `git clone` has no `bin/server` | ✅ | | Edge: fresh clone + `make` → status clean | ✅ | | Edge (DM-GAP-019 class): root `./server` — repro `M server`, then untracked+ignored+HEAD-absent+rebuild-clean+on-disk | ✅ (binary format here is ELF; class mechanics identical for Mach-O) | **Edge cases covered:** repeated/full rebuilds (`-a`) stay clean; fresh clones contain no artifacts; `git clean -fdx` won't resurrect tracked state since the path is untracked + ignored; root-level binary variant; staged-then-committed removal leaves working-tree file intact.
{"model": "deepseek-v4-flash", "problem_class": "go-repo-hygiene-tracked-build-artifact", "result": "passed", "tests": 11}