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>
Ævar Arnfjörð Bjarmason committed
Sep 28, 2021 at 15:02 UTC
34e8a20d763d46d7424f699c6ded2cf7ef66b04e
2 files changed
-51
refs/ref-cache.c
-35
@@ -212,41 +212,6 @@ struct ref_entry *find_ref_entry(struct ref_dir *dir, const char *refname)
212
return (entry->flag & REF_DIR) ? NULL : entry;
213
}
214
215
-int remove_entry_from_dir(struct ref_dir *dir, const char *refname)
216
-{
217
- int refname_len = strlen(refname);
218
- int entry_index;
219
- struct ref_entry *entry;
220
- int is_dir = refname[refname_len - 1] == '/';
221
- if (is_dir) {
222
- /*
223
- * refname represents a reference directory. Remove
224
- * the trailing slash; otherwise we will get the
225
- * directory *representing* refname rather than the
226
- * one *containing* it.
227
- */
228
- char *dirname = xmemdupz(refname, refname_len - 1);
229
- dir = find_containing_dir(dir, dirname, 0);
230
- free(dirname);
231
- } else {
232
- dir = find_containing_dir(dir, refname, 0);
233
- }
234
- if (!dir)
235
- return -1;
236
- entry_index = search_ref_dir(dir, refname, refname_len);
237
- if (entry_index == -1)
238
- return -1;
239
- entry = dir->entries[entry_index];
240
-
241
- MOVE_ARRAY(&dir->entries[entry_index],
242
- &dir->entries[entry_index + 1], dir->nr - entry_index - 1);
243
- dir->nr--;
244
- if (dir->sorted > entry_index)
245
- dir->sorted--;
246
- free_ref_entry(entry);
247
- return dir->nr;
248
-}
249
-
215
int add_ref_entry(struct ref_dir *dir, struct ref_entry *ref)
216
{
217
dir = find_containing_dir(dir, ref->name, 1);
refs/ref-cache.h
-16
@@ -199,22 +199,6 @@ void free_ref_cache(struct ref_cache *cache);
199
*/
200
void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry);
201
202
-/*
203
- * Remove the entry with the given name from dir, recursing into
204
- * subdirectories as necessary. If refname is the name of a directory
205
- * (i.e., ends with '/'), then remove the directory and its contents.
206
- * If the removal was successful, return the number of entries
207
- * remaining in the directory entry that contained the deleted entry.
208
- * If the name was not found, return -1. Please note that this
209
- * function only deletes the entry from the cache; it does not delete
210
- * it from the filesystem or ensure that other cache entries (which
211
- * might be symbolic references to the removed entry) are updated.
212
- * Nor does it remove any containing dir entries that might be made
213
- * empty by the removal. dir must represent the top-level directory
214
- * and must already be complete.
215
- */
216
-int remove_entry_from_dir(struct ref_dir *dir, const char *refname);
217
-
202
/*
203
* Add a ref_entry to the ref_dir (unsorted), recursing into
204
* subdirectories as necessary. dir must represent the top-level