find_repo_root: Find nearest Git repository root for an observed path

View source: R/find_repo_root.R

find_repo_rootR Documentation

Find nearest Git repository root for an observed path

Description

Given a filesystem path and a set of known Git repository roots, returns the nearest (deepest) matching repository root.

Usage

find_repo_root(path, repo_roots)

Arguments

path

Character. Observed filesystem path.

repo_roots

Character vector of repository root paths.

Details

The function provides lightweight repository contextualisation for observed filesystem Instantiations without querying Git history or repository internals.

Repository membership provides important operational and provenance context for later analytical interpretation:

  • grouping related filesystem observations

  • identifying software development contexts

  • distinguishing overlapping project structures

  • supporting later Record Set construction

The function performs purely structural matching:

  • no Git metadata is modified

  • no commit history is analysed

  • no repository semantics are interpreted

In RiC-aligned operational terms, the repository root acts as contextual evidence that observed filesystem Instantiations may participate in a shared documentary or development environment.

When multiple repository roots match, the deepest matching root is selected.

Value

Character. Matching repository root, or NA_character_ if no repository context is detected.


fscontext documentation built on Nov. 19, 2026, 5:11 p.m.