refs/files: refactor `add_pseudoref_and_head_entries()`
The `add_pseudoref_and_head_entries()` function accepts both the ref store as well as a directory name as input. This is unnecessary though as the ref store already uniquely identifies the root directory of the ref store anyway. Furthermore, the function is misnamed now that we have clarified the meaning of pseudorefs as it doesn't add pseudorefs, but root refs. Rename it accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Jun 6, 2024 at 07:29 UTC
66275a63117261749b40c774042bcb6e20e5d13b
1 file changed
+6
-9
refs/files-backend.c
+6
-9
@@ -324,16 +324,14 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
324
}
325
326
/*
327
- * Add pseudorefs to the ref dir by parsing the directory for any files
328
- * which follow the pseudoref syntax.
327
+ * Add root refs to the ref dir by parsing the directory for any files which
328
+ * follow the root ref syntax.
329
*/
330
-static void add_pseudoref_and_head_entries(struct ref_store *ref_store,
331
- struct ref_dir *dir,
332
- const char *dirname)
330
+static void add_root_refs(struct files_ref_store *refs,
331
+ struct ref_dir *dir)
332
{
334
- struct files_ref_store *refs =
335
- files_downcast(ref_store, REF_STORE_READ, "fill_ref_dir");
333
struct strbuf path = STRBUF_INIT, refname = STRBUF_INIT;
334
+ const char *dirname = refs->loose->root->name;
335
struct dirent *de;
336
size_t dirnamelen;
337
DIR *d;
@@ -388,8 +386,7 @@ static struct ref_cache *get_loose_ref_cache(struct files_ref_store *refs,
386
dir = get_ref_dir(refs->loose->root);
387
388
if (flags & DO_FOR_EACH_INCLUDE_ROOT_REFS)
391
- add_pseudoref_and_head_entries(dir->cache->ref_store, dir,
392
- refs->loose->root->name);
389
+ add_root_refs(refs, dir);
390
391
/*
392
* Add an incomplete entry for "refs/" (to be filled