fix(project): case-sensitive isGitRepo + injectable GitChecker#163
fix(project): case-sensitive isGitRepo + injectable GitChecker#163neversettle17-101 wants to merge 2 commits into
Conversation
Greptile SummaryIntroduces a
Confidence Score: 5/5Safe to merge; the refactor is well-scoped, backward-compatible, and all changed paths are covered by tests. The case-sensitivity fix replaces a clear incorrect behaviour with a correct platform-gated implementation. The GitChecker injection follows a clean constructor-injection pattern; New delegates to NewWithGitChecker so no call sites break. The free-function isGitRepo wrapper is still reachable from workspace_registration.go so there is no dead code. Tests exercise both the happy path and the rejection path through the fake seam. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "test(project): drop real-git assertion f..." | Re-trigger Greptile |
Restores the GitChecker seam and case-sensitivity fix deferred from #95 (reverted in e3d2533). - samePath compares cleaned, symlink-resolved paths and is case-insensitive only on darwin/windows; on case-sensitive filesystems (Linux) paths differing only in case are now distinct. - Git repo check moves behind a GitChecker interface injected into Service, so the service is testable with a fake — no real git binary or working tree. Closes #97 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The execGitChecker.IsRepo(tempdir) check in TestSamePath_CaseSensitivity silently passed when git was absent from PATH (cmd.Output() fails -> false), so it never exercised the git path it implied. Remove it; the test now only asserts the samePath platform contract, which has no git dependency. Drops the now-unused NewExecGitCheckerForTest shim. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
f31afc3 to
dac9482
Compare
Summary
Resolves the two
isGitRepofindings deferred from #95 / PR #96 (an implementation existed there and was reverted in e3d2533; this restores it).1. Case-sensitivity bug on Linux
The old
isGitRepousedstrings.EqualFold(top, path), which wrongly treats/home/u/MyRepoand/home/u/myrepoas the same path on case-sensitive filesystems. Replaced withsamePath, which is case-insensitive only on darwin/windows (gated byruntime.GOOS) and uses==everywhere else.2. Untestable git check
The git check shelled out to
exec.Command("git", ...)directly, soproject.Servicecouldn't be tested without a real git binary and working tree. The check now sits behind aGitCheckerinterface injected intoService:execGitChecker— production impl, shells out to git.NewWithGitChecker(store, git)— lets tests substitute a fake.Tests
TestAdd_UsesInjectedGitChecker/TestAdd_RejectsNonRepoViaGitChecker— exerciseAddthrough a fakeGitChecker, no git binary.TestSamePath_CaseSensitivity— guards the platform contract forsamePath.Acceptance criteria
isGitRepocorrect on case-sensitive filesystemsCloses #97
🤖 Generated with Claude Code