Skip to main content

Module git

Module git 

Source
Expand description

fs.git_status: what git says about the entries of a listed folder, for the Files pane’s markers (modified, untracked, ignored…) and its status line (branch, ahead/behind).

Running git inside a folder the user merely browsed must not run code the folder chose. A repository’s own config can name programs that git status executes: core.fsmonitor, and a filter.<name>.clean (or .process) applied through its .gitattributes whenever a file’s stat data differs from the index. Command-line -c settings win over every config file, so the fsmonitor is turned off and every filter the repository itself defines is blanked; the user’s own system and global filters (Git LFS) are left alone. Submodules, which have configs of their own, are not entered. The status never writes the index (--no-optional-locks), prompts for nothing, and is killed after a few seconds on a huge repository.

Every run here reads what is already on the disk: none fetches a missing object, and none may start a transport (NO_NETWORK_ENV). Those two are set in the environment, where no config file can change them.

Git facts of a container agent are read inside its container: for a folder a container agent can write, or anything inside it, no git is started on the host. The same command runs in the agent’s container, as the agent, at the same folder there (super::container_folders), and says nothing while that container is not running.

Spec: docs/specs/SPEC_FILE_BROWSER_PANE_2026_10_01.md §12 (Phase 2, git decorations).

Structs§

GitRecord
One path git reported, relative to the repository’s top.
Porcelain
What git status --porcelain=v2 -z --branch printed.

Constants§

NOT_READ_ON_THE_HOST
What a git run answers, without starting git, while it can’t be told whose the folder is.
NO_NETWORK_ENV
Set on every git run here: a read of the folder as it is. git does not fetch an object the repository lacks, and no transport is allowed (an empty list of allowed protocols), whatever the repository’s config says.

Functions§

filter_names
Filter names from git config [--show-scope] --name-only --get-regexp ^filter\. output; with scopes, only those outside system and global.
git_status
fs.git_status for raw (a folder the pane listed).
parse_porcelain_v2
Parse porcelain v2 output (-z: NUL-terminated records; a rename’s original path follows it as its own NUL-terminated field).
summarize
Fold the records under prefix (the listed folder, relative to the repository’s top, /-separated with a trailing /, or empty) into one state per direct child. A folder takes the most pressing state of what’s inside it, except that a folder is only “ignored” when git ignores the folder itself.