From 627045e9c76c42d8ed50f7a6d1f5746f6d1ed392 Mon Sep 17 00:00:00 2001 From: Jeff Hostetler Date: Mon, 24 Jun 2024 11:24:20 -0400 Subject: [PATCH] wt-status: add VFS hydration percentage to normal `git status` output 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 of tracked files present." message. Upstream `git status` normally prints a "You are in a sparse checkout with 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 Signed-off-by: Jeff Hostetler --- t/t1093-virtualfilesystem.sh | 2 ++ wt-status.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/t/t1093-virtualfilesystem.sh b/t/t1093-virtualfilesystem.sh index cad13d680cb199..7786735dffec06 100755 --- a/t/t1093-virtualfilesystem.sh +++ b/t/t1093-virtualfilesystem.sh @@ -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 diff --git a/wt-status.c b/wt-status.c index 076ccb1181ea5a..9eef96e85bf7a3 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1612,10 +1612,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,