From 061dadfa4b33f47524a626af74a36ef238d364f2 Mon Sep 17 00:00:00 2001 From: Tibsfox Date: Sat, 28 Feb 2026 04:41:01 -0800 Subject: [PATCH] fix(core): add --no-index to isGitIgnored for tracked file detection (#703) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without --no-index, git check-ignore only reports files as ignored if they are untracked. Once .planning/ files enter git's index (e.g., from an initial commit before .gitignore was set up), check-ignore returns "not ignored" even when .gitignore explicitly lists .planning/. This means the documented safety net — "if .planning/ is gitignored, commit_docs is automatically false" — silently fails for any repo where .planning/ was ever committed. The --no-index flag checks .gitignore rules regardless of tracking state, matching user expectations. Closes #703 Co-Authored-By: Claude Opus 4.6 --- get-shit-done/bin/lib/core.cjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/get-shit-done/bin/lib/core.cjs b/get-shit-done/bin/lib/core.cjs index 6ef6ccb2a..76d349cf9 100644 --- a/get-shit-done/bin/lib/core.cjs +++ b/get-shit-done/bin/lib/core.cjs @@ -124,7 +124,11 @@ function loadConfig(cwd) { function isGitIgnored(cwd, targetPath) { try { - execSync('git check-ignore -q -- ' + targetPath.replace(/[^a-zA-Z0-9._\-/]/g, ''), { + // --no-index checks .gitignore rules regardless of whether the file is tracked. + // Without it, git check-ignore returns "not ignored" for tracked files even when + // .gitignore explicitly lists them — a common source of confusion when .planning/ + // was committed before being added to .gitignore. + execSync('git check-ignore -q --no-index -- ' + targetPath.replace(/[^a-zA-Z0-9._\-/]/g, ''), { cwd, stdio: 'pipe', });