Files
Darren Schroeder 4b60dee2f6 fix(gstat): stop wrapping counts and reporting unreadable status as clean, fill ignored and wt_renamed, link libgit2 statically (#19233)
## Description

`gstat` gave wrong answers in several situations, all from the plugin's
own code rather than from libgit2. I compared it with `git status` on
fixture repos (built with git 2.56) and confirmed each case on the 0.116
plugin.

## User-facing changes (Release notes)

- `gstat` no longer wraps its counts above 65,535. A repository with
70,000 untracked files used to report 4,464.
- When `gstat` can't read a repository's status (a split or sparse
index, a damaged index, or a bare repository), the status counts
(`idx_*`, `wt_*`, `ignored`, `conflicts`) are now -1 instead of 0, so
the repository no longer looks clean. The other fields are still filled.
- `gstat` now fills `ignored` (an ignored directory counts once) and
`wt_renamed`. A file renamed without `git mv` now counts as one
`wt_renamed` instead of one `wt_deleted` plus one `wt_untracked`, and
also as `wt_modified` if it was edited after the move.
- In a repository with no commits yet, `branch` shows the branch `HEAD`
points to instead of `master` or `HEAD`.
- `repo_name` is now the name of the working directory in linked
worktrees and submodules (it used to be `worktrees` or `modules`) and
the repository's own directory name for bare repositories.
- The gstat plugin starts faster on systems where it used to link a
system libgit2, such as a `cargo install` on macOS with Homebrew's
libgit2.


## Additional notes

Replacing git2 with gitoxide (`gix`) would make each call about 2x
faster, but it adds 60 crates. I measured it separately and left it out
of this PR.
2026-10-14 07:48:27 -05:00
..
2025-12-01 11:05:56 -06:00

Git stat plugin for Nushell

Note: this requires Nushell 0.60 or later

To install:

> cargo install --path .

To add the plugin (from inside Nushell):

> plugin add <path to installed plugin>