summaryrefslogtreecommitdiffstats
path: root/t/t4013/diff.format-patch_--inline_--stdout_initial..master^
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-01-12 10:02:50 +0100
committerJunio C Hamano <gitster@pobox.com>2026-01-12 06:55:40 -0800
commitdf971a7c42fa5506cb7e845ac175104093c35e8d (patch)
tree5cbaeb8c13a1723ef9f08b2531e5e36cd09e8e3c /t/t4013/diff.format-patch_--inline_--stdout_initial..master^
parentd529f3a197364881746f558e5652f0236131eb86 (diff)
downloadgit-df971a7c42fa5506cb7e845ac175104093c35e8d.tar.gz
git-df971a7c42fa5506cb7e845ac175104093c35e8d.zip
refs/files: simplify iterating through root refs
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. But next to the added confusion, it can also lead to a segfault. The loose ref cache is populated lazily, so it may not always be set. It seems to be sheer luck that this is a condition we do not currently hit. The right thing to do would be to call `get_loose_ref_cache()`, which knows to populate the cache if required. Simplify the code and fix the potential segfault by simply removing the indirection via the loose ref cache completely. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.format-patch_--inline_--stdout_initial..master^')
0 files changed, 0 insertions, 0 deletions