Open jeffhostetler opened 4 months ago
I don't want to force the foreground status command to read the index just to have index stats -- reading the index on the Windows repo is very expensive because of the size.
It would be relatively easy to add another field to the serialization format and let the background status command add it to the cache file. In the deserialize code, parse the value into a global variable (sigh, I know). Then in wt_status_check_sparse_checkout()
check the global variable, set the state->sparse_checkout_percentage, and return -- before the first if
statement in the existing function.
BTW, I already have some hydration stats in the data stream, so there may be some overlap.
https://github.com/microsoft/git/blob/vfs-2.45.2/virtualfilesystem.c#L374-L381
In [1] we added code to print the GVFS hydration percentage in
git status
whencore.virtualfilesystem
is set. GVFS users may not see this message because of the "GVFS Status Cache" feature of the "GVFS Mount Daemon".The GVFS mount daemon periodically runs a
git status --serialize
in the background (after certain file system operations) and write the result to a "status-cache-file". When GVFS users rungit status
it silently assume--deserialize
and asks the mount daemon if there is a valid cache file and simply prints the cache result on the console. The foreground status command does not scan the worktree and it does not even load the index. All it needs to do is to decode the cache file and print it.Since the foreground status command does not load the index, it cannot compute the hydration percentage (and to make matters confusing, in the foreground status command in
wt_status_get_state()
andwt_status_check_sparse_checkout()
the variabler->index
is non-null, but the fields within it are zero. Thereforer->index->cache_nr == 0
. Thereforestate->sparse_checkout_percentage
is set toSPARSE_CHECKOUT_DISABLED
. So inwt_status_print()
we DO NOT emit the Trace2sparse-checkout/percentage
. We also DO NOT print any of the messages inshow_sparse_checkout_in_use()
.(The background
git status --serialize
command will Trace2 log them (stdout is closed, so no one will see the new print messages), so we can still get telemetry, but interactive users won't see the new feature.)[1] https://github.com/microsoft/git/compare/78b268cc35d3bca418c38f4c2bb8798268858ea2...7975c98ed878b00ed538baa1bccaaaefc988a5ef