Skip to content

feat: support git-backed subfolder vaults#511

Open
dieend wants to merge 25 commits intorefactoringhq:mainfrom
dieend:dth/git-subfolder
Open

feat: support git-backed subfolder vaults#511
dieend wants to merge 25 commits intorefactoringhq:mainfrom
dieend:dth/git-subfolder

Conversation

@dieend
Copy link
Copy Markdown

@dieend dieend commented May 3, 2026

Summary

Adds support for opening a Tolaria vault from a subfolder inside a larger Git repository.

Git discovery now resolves the parent worktree for a vault path, while Tolaria scopes file-facing Git behavior to the opened vault subtree. This allows multiple vaults or external systems to share one repository without Tolaria showing or committing unrelated sibling/root changes.

Note: Code fully generated by Codex GPT 5.5, and I don't have rust setup. Feel free to throw it away.

close #510

Why

I use Obsidian structure under openclaw agent, and would like to separate opening Tolaria and openclaw workspace.

Changes

  • Added GitRepoContext to resolve:
    • worktree root
    • Git directory
    • vault-relative prefix inside the repo
  • Updated Git-backed detection to use Git discovery instead of vault/.git.
  • Scoped Changes, diffs, history, Pulse, conflict files, discard, conflict resolution, cache Git paths, and app commits to the active vault subtree.
  • Kept pull/push/remotes as repo-level operations.
  • Made init_git_repo a no-op when the selected folder is already inside a Git worktree, avoiding nested .git metadata.
  • Added regression coverage for committing a nested vault while leaving outside repo changes untouched.
  • Documented the behavior in Architecture/Abstractions and added ADR-0108.

Copy link
Copy Markdown

@codacy-production codacy-production Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR cannot be merged in its current state as it contains no file changes, rendering it impossible to verify the claimed support for git-backed subfolder vaults. While Codacy results are nominally 'up to standards', the analysis is incomplete due to the missing diff.

A major concern is the author's admission that the code was fully generated by an AI model and has not been tested locally. This represents a significant risk for core repository operations. Additionally, none of the required acceptance criteria, such as the scoping of Git operations or the creation of ADR-0108, have been met.

About this PR

  • Implementing architectural changes to Git handling using untested AI-generated code is a high-risk activity. The changes must be validated in a local Rust environment to ensure they do not corrupt Git repository structures.
  • The PR does not contain any code changes or the required documentation (ADR-0108). Please ensure all files are correctly staged and pushed.

Test suggestions

  • Opening a vault in a subfolder of an existing Git repository resolves the correct worktree root.
  • Committing changes in a subfolder vault includes only files within that vault subtree, ignoring root-level or sibling changes.
  • Syncing (push/pull) in a subfolder vault affects the entire parent repository as intended.
  • Calling init_git_repo on a folder already inside a Git worktree does not create a nested .git directory.
  • Git history and diff views correctly filter results to the vault-relative path.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Opening a vault in a subfolder of an existing Git repository resolves the correct worktree root.
2. Committing changes in a subfolder vault includes only files within that vault subtree, ignoring root-level or sibling changes.
3. Syncing (push/pull) in a subfolder vault affects the entire parent repository as intended.
4. Calling init_git_repo on a folder already inside a Git worktree does not create a nested .git directory.
5. Git history and diff views correctly filter results to the vault-relative path.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 3, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 43 complexity · 0 duplication

Metric Results
Complexity 43
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow git subfolder to work with Tolaria

1 participant