Offer to adopt an enclosing git repository when opening a subfolder

When a workspace folder isn't a git repo itself but sits inside one, ask
the user to confirm before using the parent repository for Sync, rather
than silently operating on whichever repo git walks up to find.

- gitsync: add repo_root() via `git rev-parse --show-toplevel`
- app: detect_repo() distinguishes repo-root / parent-repo / no-repo;
  a confirmation dialog adopts or declines the parent repo; git_init
  tracks repo_root and clears any pending prompt
- Sync button hover names the enclosing repo when one is adopted

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
landon
2026-07-28 11:58:47 -05:00
parent 496bbfd298
commit b31ac0c6c8
3 changed files with 151 additions and 5 deletions
+6
View File
@@ -63,6 +63,12 @@ Terminal=false
```
After that, the **⟳ Sync (git)** button commits all changes, `pull --rebase`s,
and pushes.
If you open a folder that is *not* itself a repository but sits inside one
(a parent directory is a git work tree), the app asks whether to **use the
enclosing repository**. Accept it to have **⟳ Sync** commit and push to that
repo; decline to leave the workspace on its own, where **Init git** creates a
separate repository in the folder.
3. Create files with ** New**, edit on the right, `Ctrl+S` (or the Save button)
to write to disk. Drag the `` handles to reorder. Use the **Zoom** slider
above the editor to scale the editor text (0% = default; **Reset** returns to