Skip to content

Conversation

@tyrielv
Copy link
Contributor

@tyrielv tyrielv commented Nov 18, 2025

For a few releases, git status would output a message like "You are in a partially-hydrated checkout with 1% of tracked files present."

However, this implementation only measured files that had been modified; files that were hydrated but unmodified were not included, so the change was reverted.

This change adds a line to the start of git status similar to "1% of files and 1% of folders hydrated. Run 'gvfs health' for details."

I decided to show separate %s for files and folders because I think there is a meaningful difference between "0% files and 100% folders" and "10% files and 10% folders", but if combined both could display as "11% total hydration" (with ~1:10 ratio of folders to files).

** Changes **

  1. A new option is added to gvfs health verb, --status, to display the new output line.
  2. Gvfs.Hooks.exe will call gvfs health --status on pre-command hook for git status except when called with --serialize.
  3. The hydration %s are calculated from:
    • the number of files/folders in placeholder database
    • the number of files/folders in modified database
    • the total number of files, from git index header
    • the total number of folders, from git ls-tree -r -d HEAD
  4. Because the git ls-tree command can be slow for large repos, its result is cached.
    • GitStatusCache is modified log the hydration stats to telemetry, which ensures the cache is up-to-date.
    • The new cache file is stored in a new file TreeCountCache.dat next to the existing GitStatusCache.dat.
    • The cache is keyed off the tree ID of HEAD.
  5. Refactoring: Reading the placeholder, modified DB file/folder lists, and index file/folder lists are moved from HealthVerb to EnlistmentPathData
  6. If the repo is not mounted, gvfs health [--status] will attempt to read the modified file list directly instead of getting it from the current mount process.

For a few releases, `git status` would output a message like
"You are in a partially-hydrated checkout with 1% of tracked files present."

However, this implementation only measured files that had been modified; files
that were hydrated but unmodified were not included, so the change was reverted.

This change adds a line to the start of `git status` similar to
"1% of files and 1% of folders hydrated. Run 'gvfs health' for details."

I decided to show separate %s for files and folders  because I think there is a
meaningful difference between "0% files and 100% folders" and
"10% files and 10% folders", but if combined both could display as
"11% total hydration" (with ~1:10 ratio of folders to files).

** Changes **

1. A new option is added to `gvfs health` verb, `--status`, to display the new
output line.
2. Gvfs.Hooks.exe will call `gvfs health --status` on pre-command hook for
`git status` except when called with --serialize.
3. The hydration %s are calculated from:
   - the number of files/folders in placeholder database
   - the number of files/folders in modified database
   - the total number of files, from git index header
   - the total number of folders, from `git ls-tree -r -d HEAD`
4. Because the git ls-tree command can be slow for large repos, its result is
cached.
   - GitStatusCache is modified log the hydration stats to telemetry, which
   ensures the cache is up-to-date.
   - The new cache file is stored in a new file TreeCountCache.dat next to
   the existing GitStatusCache.dat.
   - The cache is keyed off the tree ID of HEAD.
5. Refactoring: Reading the placeholder, modified DB file/folder lists, and
   index file/folder lists are moved from HealthVerb to EnlistmentPathData
6. If the repo is not mounted, `gvfs health [--status]` will attempt to read the
modified file list directly instead of getting it from the current mount process.
@tyrielv tyrielv merged commit 45d0405 into microsoft:master Dec 1, 2025
49 checks passed
@mjcheetham mjcheetham mentioned this pull request Dec 4, 2025
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.

4 participants