Skip to content

LLD: isGitRepo case-sensitivity bug + untestable git check (deferred from #95) #97

@neversettle17-101

Description

@neversettle17-101

Summary

Two isGitRepo findings from the LLD review of backend/internal/service/project/service.go were split out of #95 (PR #96) and deferred. This issue tracks them.


1. [Medium] isGitRepo case-sensitivity bug on Linux

if strings.EqualFold(top, path) {
    return true
}
return top == path

On case-sensitive filesystems (Linux), EqualFold will wrongly treat /home/user/MyRepo and /home/user/myrepo as the same path.

Fix: Drop the EqualFold branch and rely on == after filepath.EvalSymlinks on all platforms, or gate the case-insensitive compare behind a runtime.GOOS check (darwin/windows only).

  • backend/internal/service/project/service.go (isGitRepo)

2. [Medium] isGitRepo is untestable — shells out with no seam

isGitRepo calls exec.Command("git", ...) directly, so project.Service cannot be tested without a real filesystem and a real git binary.

Fix: Put the git check behind a GitChecker interface injected into Service (real impl shells out, fake for tests).

  • backend/internal/service/project/service.go

Acceptance criteria

  • isGitRepo correct on case-sensitive filesystems
  • Project service testable without a real git binary

Split out of #95 / PR #96 to keep that PR focused. An implementation existed in PR #96 and was reverted in commit e3d2533 — it can serve as a starting point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions