diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-09-28 16:02:21 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-29 01:12:04 +0300 |
commit | 34e8a20d763d46d7424f699c6ded2cf7ef66b04e (patch) | |
tree | b80764c030bab5ba63770e054732b3108dfa4088 /refs/ref-cache.c | |
parent | 98961e42f047bf0a9891d6c7d58d54e86285ae52 (diff) |
refs/ref-cache.[ch]: remove unused remove_entry_from_dir()
This function was missed in 9939b33d6a3 (packed-backend: rip out some
now-unused code, 2017-09-08), and has been orphaned since then. Let's
delete it.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/ref-cache.c')
-rw-r--r-- | refs/ref-cache.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/refs/ref-cache.c b/refs/ref-cache.c index 49d732f6db..e0feebf628 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -212,41 +212,6 @@ struct ref_entry *find_ref_entry(struct ref_dir *dir, const char *refname) return (entry->flag & REF_DIR) ? NULL : entry; } -int remove_entry_from_dir(struct ref_dir *dir, const char *refname) -{ - int refname_len = strlen(refname); - int entry_index; - struct ref_entry *entry; - int is_dir = refname[refname_len - 1] == '/'; - if (is_dir) { - /* - * refname represents a reference directory. Remove - * the trailing slash; otherwise we will get the - * directory *representing* refname rather than the - * one *containing* it. - */ - char *dirname = xmemdupz(refname, refname_len - 1); - dir = find_containing_dir(dir, dirname, 0); - free(dirname); - } else { - dir = find_containing_dir(dir, refname, 0); - } - if (!dir) - return -1; - entry_index = search_ref_dir(dir, refname, refname_len); - if (entry_index == -1) - return -1; - entry = dir->entries[entry_index]; - - MOVE_ARRAY(&dir->entries[entry_index], - &dir->entries[entry_index + 1], dir->nr - entry_index - 1); - dir->nr--; - if (dir->sorted > entry_index) - dir->sorted--; - free_ref_entry(entry); - return dir->nr; -} - int add_ref_entry(struct ref_dir *dir, struct ref_entry *ref) { dir = find_containing_dir(dir, ref->name, 1); |