Re: [PATCH v5 2/5] ref-cache: remove unused function 'find_ref_entry()'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 17, 2025, 14:48 UTC
- Message-ID
- <xmqqtt3a7u08.fsf@gitster.g>
- In-Reply-To
- <20250715-306-git-for-each-ref-pagination-v5-2-852d5a2f56e1@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
> The 'find_ref_entry' function is no longer used, so remove it.
If my spelunking is correct, ba1c052f (ref_store: implement `refs_peel_ref()` generically, 2017-09-25) is the commit that removed the last caller of it. Which may be worth noting here.
Show 49 quoted lines
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
> refs/ref-cache.c | 14 --------------
> refs/ref-cache.h | 7 -------
> 2 files changed, 21 deletions(-)
>
> diff --git a/refs/ref-cache.c b/refs/ref-cache.c
> index c1f1bab1d5..8aaffa8c6b 100644
> --- a/refs/ref-cache.c
> +++ b/refs/ref-cache.c
> @@ -194,20 +194,6 @@ static struct ref_dir *find_containing_dir(struct ref_dir *dir,
> return dir;
> }
>
> -struct ref_entry *find_ref_entry(struct ref_dir *dir, const char *refname)
> -{
> - int entry_index;
> - struct ref_entry *entry;
> - dir = find_containing_dir(dir, refname);
> - if (!dir)
> - return NULL;
> - entry_index = search_ref_dir(dir, refname, strlen(refname));
> - if (entry_index == -1)
> - return NULL;
> - entry = dir->entries[entry_index];
> - return (entry->flag & REF_DIR) ? NULL : entry;
> -}
> -
> /*
> * Emit a warning and return true iff ref1 and ref2 have the same name
> * and the same oid. Die if they have the same name but different
> diff --git a/refs/ref-cache.h b/refs/ref-cache.h
> index 5f04e518c3..f635d2d824 100644
> --- a/refs/ref-cache.h
> +++ b/refs/ref-cache.h
> @@ -201,13 +201,6 @@ void free_ref_cache(struct ref_cache *cache);
> */
> void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry);
>
> -/*
> - * Find the value entry with the given name in dir, sorting ref_dirs
> - * and recursing into subdirectories as necessary. If the name is not
> - * found or it corresponds to a directory entry, return NULL.
> - */
> -struct ref_entry *find_ref_entry(struct ref_dir *dir, const char *refname);
> -
> /*
> * Start iterating over references in `cache`. If `prefix` is
> * specified, only include references whose names start with that