Documentation
¶
Overview ¶
Package gitfs provides pure-Go helpers for inspecting on-disk git repositories. It does NOT shell out to the git binary and does NOT depend on any third-party git library. It only handles the narrow problems arc needs: locating .git entries and following linked worktree pointers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectMainRepo ¶
DetectMainRepo returns the canonical path of the main repository if dir is inside a linked git worktree. Returns "" if dir is in the main worktree, has no reachable .git entry, or the .git pointer is malformed.
Two layouts are supported:
Worktree of a normal repo: .git is a file like "gitdir: /abs/path/main/.git/worktrees/<name>". This function returns the main repo's working directory (parent of the .git directory).
Worktree of a bare repo: .git is a file like "gitdir: /abs/path/repo.git/worktrees/<name>". A bare repo has no working directory; this function returns the bare repo path itself (validated by checking for HEAD and objects/).
func FindGitEntry ¶
FindGitEntry walks up from dir to locate a .git entry (file or directory). Returns the absolute path to the .git entry, or "" if none is found before reaching the filesystem root.
Types ¶
This section is empty.