Re: [PATCH 01/17] refs/files: simplify iterating through root refs
- From
shejialuo <shejialuo@gmail.com>
- Date
- Jan 10, 2026, 12:28 UTC
- Message-ID
- <aWJF0NNDnuIUXbMo@ArchLinux>
- In-Reply-To
- <20260109-pks-refs-verify-fixes-v1-1-3587dba18294@pks.im>
On Fri, Jan 09, 2026 at 01:39:30PM +0100, Patrick Steinhardt wrote:
Show 13 quoted lines
> When iterating through root refs we first need to determine the > directory in which the refs live. This is done by retrieving the root of > the loose refs via `refs->loose->root->name`, and putting it through > `files_ref_path()` to derive the final path. > > This is somewhat redundant though: the root name of the loose files > cache is always going to be the empty string. As such, we always end up > passing that empty string to `files_ref_path()` as the ref hierarchy we > want to start. And this actually makes sense: `files_ref_path()` already > computes the location of the root directory, so of course we need to > pass the empty string for the ref hierarchy itself. So going via the > loose ref cache to figure out that the root of a ref hierarchy is empty > is only causing confusion.
Make sense, in `refs/ref-cache.c` we would call the following to create the root loose cache:
ret->root = create_dir_entry(ret, "", 0)
It would always be empty.
Thanks, Jialuo