Skip to content

Commit 66275a6

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fbd1a69 commit 66275a6

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

refs/files-backend.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,14 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
324324
}
325325

326326
/*
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.
329329
*/
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)
333332
{
334-
struct files_ref_store *refs =
335-
files_downcast(ref_store, REF_STORE_READ, "fill_ref_dir");
336333
struct strbuf path = STRBUF_INIT, refname = STRBUF_INIT;
334+
const char *dirname = refs->loose->root->name;
337335
struct dirent *de;
338336
size_t dirnamelen;
339337
DIR *d;
@@ -388,8 +386,7 @@ static struct ref_cache *get_loose_ref_cache(struct files_ref_store *refs,
388386
dir = get_ref_dir(refs->loose->root);
389387

390388
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);
393390

394391
/*
395392
* Add an incomplete entry for "refs/" (to be filled

0 commit comments

Comments
 (0)