Skip to content

Commit

Permalink
wt-status: add VFS hydration percentage to normal git status output
Browse files Browse the repository at this point in the history
Add VFS checkout hydration percentage information to the default `git
status` output.  When VFS is enable, users will now see a "You are in
a partially-hydrated checkout with <percentage> of tracked files
present." message.

Upstream `git status` normally prints a "You are in a sparse checkout
with <percentage> of tracked files present."  This message was hidden
in `microsoft/git` when `core_virtualfilesystem` is set (because GVFS
users are always (and secretly) in a sparse checkout) and it was
thought that it would annoy users.

However, we now believe that it may be helpful for users to always see
the percentage and know when they are over-hyrdated, since
over-hyrdation can occur by accident and may greatly impact their Git
performance.  Knowing this value may help with GVFS support.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
  • Loading branch information
jeffhostetler committed Jun 24, 2024
1 parent bbddf35 commit 8ef4820
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions t/t1093-virtualfilesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ test_expect_success 'verify status is clean' '
git status > actual &&
cat > expected <<-\EOF &&
On branch main
You are in a partially-hydrated checkout with 75% of tracked files present.
nothing to commit, working tree clean
EOF
test_cmp expected actual
Expand Down
13 changes: 9 additions & 4 deletions wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,10 +1604,15 @@ static void show_sparse_checkout_in_use(struct wt_status *s,
{
if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_DISABLED)
return;
if (core_virtualfilesystem)
return;

if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_SPARSE_INDEX)
if (core_virtualfilesystem) {
if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_SPARSE_INDEX)
status_printf_ln(s, color,
_("You are in a partially-hydrated checkout with a sparse index."));
else
status_printf_ln(s, color,
_("You are in a partially-hydrated checkout with %d%% of tracked files present."),
s->state.sparse_checkout_percentage);
} else if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_SPARSE_INDEX)
status_printf_ln(s, color, _("You are in a sparse checkout."));
else
status_printf_ln(s, color,
Expand Down

0 comments on commit 8ef4820

Please sign in to comment.