Re: [PATCH 4/5] scalar: teach `diagnose` to gather loose objects information
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Jan 27, 2022, 15:17 UTC
- Message-ID
- <027ebd30-77c7-1f09-9fe1-0523b9487319@gmail.com>
- In-Reply-To
- <YfHQSrdkieNuBEXT@nand.local>
On 1/26/2022 5:50 PM, Taylor Blau wrote:
Show 13 quoted lines
> On Wed, Jan 26, 2022 at 08:41:46AM +0000, Matthew John Cheetham via GitGitGadget wrote:
>> + while ((e = readdir(dir)) != NULL)
>> + if (!is_dot_or_dotdot(e->d_name) &&
>> + e->d_type == DT_DIR && strlen(e->d_name) == 2 &&
>> + !hex_to_bytes(&c, e->d_name, 1)) {
>
> What is this call to hex_to_bytes() for? I assume it's checking to make
> sure the directory we're looking at is one of the shards of loose
> objects.
>
> Similar to my suggestion on the previous patch, I think that we could
> get rid of this function entirely and replace it with a call to
> for_each_loose_file_in_objdir().There is a possibility that there are files other than loose objects in these directories, so summarizing those counts might be helpful information. For example: if somehow .git/objects/00/ was full of a bunch of non-objects, it would still slow down Git commands that ask for a short-sha starting with "00".
While this shouldn't be a normal case, the 'diagnose' command is built to help us find these extremely odd scenarios because they _have_ happened before (typically because of a VFS for Git bug taught us how to look for these situations).
Thanks, -Stolee