apache / apache/maka

Invalid ancestor .git marker prevents adding a plain folder

Open
#4,806 1 comment 0 reactions 1 assignee Claimed by @faga295 View on GitHub
bug
Dominant language
TypeScript
Stars
5.4k
Forks
502
Avg merge
1d 2h
Merged PRs (30d)
715

Description

### What happened

A plain folder nested below an incomplete `.git` directory is treated as if it were inside a Git repository. Adding the folder through Project Catalog then invokes Git; `git rev-parse` fails and the mutation surfaces as `project.catalog.mutate → commit_outcome_unknown`.

Expected: if the selected folder has no `.git` entry and an ancestor's `.git` metadata is structurally invalid, Maka should handle the selection like an ordinary non-Git folder. A malformed `.git` entry in the selected folder itself should continue to fail closed.

### How to reproduce

1. Create an incomplete ancestor Git marker and a nested plain folder:
`mkdir -p /tmp/maka-invalid-git/.git/gk /tmp/maka-invalid-git/project`
2. Open Maka Desktop.
3. Add `/tmp/maka-invalid-git/project` as a project.
4. Observe that registration fails with `project.catalog.mutate → commit_outcome_unknown`.

`git -C /tmp/maka-invalid-git/project rev-parse --show-toplevel` also exits 128 because Git discovers the malformed ancestor marker.

### Environment

- Maka version or commit: fde5fb078
- OS and version: macOS 14.7.8
- Surface: Desktop / Runtime Host Project Catalog
- Node.js version, if running from source: v25.9.0

### Logs, screenshots, or additional context

The ancestor `.git` contains only `.git/gk/`; it has no `HEAD`. `hasEnclosingGitEntry` currently treats any lstat-able `.git` entry as a repository marker, so the downstream Git probe receives corrupted ancestor state.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.