Skip to content

Add 'gvfs cache' verb to display shared cache info#1924

Open
tyrielv wants to merge 1 commit intomicrosoft:masterfrom
tyrielv:tyrielv/gvfs-cache-verb
Open

Add 'gvfs cache' verb to display shared cache info#1924
tyrielv wants to merge 1 commit intomicrosoft:masterfrom
tyrielv:tyrielv/gvfs-cache-verb

Conversation

@tyrielv
Copy link
Copy Markdown
Contributor

@tyrielv tyrielv commented Mar 26, 2026

Summary

Adds a new gvfs cache verb that displays a summary of the shared object cache for a GVFS enlistment.

Example output

`

gvfs cache D:\o2

Repo URL: https://example.com
Cache root: D:.gvfsCache
Git objects: D:.gvfsCache\a736f27769764f4b9904948574fa111b\gitObjects

Total pack size: 29.7 GB
Prefetch packs: 89 (9.3 GB)
Other packs: 12 (20.4 GB)
Latest prefetch: 2026-03-26 11:01:19 -07:00
Loose objects: 1,355,506
`

What it does

  • Reads cache paths from RepoMetadata (same pattern as DiagnoseVerb)
  • Scans pack directory for prefetch vs non-prefetch packs, reporting count and size
  • Counts loose objects across the 256 hex directories
  • Emits a CacheInfo telemetry event with all stats
  • Logs an error via tracer if the pack directory is missing

Motivation

Provides quick visibility into cache state -- useful for diagnosing cache growth, verifying prefetch is working, and future tooling around cache management (e.g., triggering repack, pruning).

Changes

  • CacheVerb.cs -- New verb inheriting ForExistingEnlistment
  • Program.cs -- Register CacheVerb in verb types
  • CacheVerbTests.cs -- Unit tests for FormatSize, GetPackSummary, and CountLooseObjects

@tyrielv tyrielv marked this pull request as ready for review March 28, 2026 00:25
@tyrielv tyrielv force-pushed the tyrielv/gvfs-cache-verb branch from f15ab14 to 8766f96 Compare March 31, 2026 17:49
Copy link
Copy Markdown

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

Copy link
Copy Markdown

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

Copy link
Copy Markdown

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

Copy link
Copy Markdown

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

Copy link
Copy Markdown

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

Copy link
Copy Markdown

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

Copy link
Copy Markdown

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

@tyrielv tyrielv force-pushed the tyrielv/gvfs-cache-verb branch from 8766f96 to 7add77f Compare April 2, 2026 15:05
Shows cache root, git objects path, repo URL, pack file summary
(prefetch count/size, other pack count/size, latest prefetch timestamp),
and loose object count. Emits a CacheInfo telemetry event with all stats.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv tyrielv force-pushed the tyrielv/gvfs-cache-verb branch from 7add77f to f07bf41 Compare April 2, 2026 15:10
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.

2 participants