Skip to content

Commit 34e8a20

Browse files
avargitster
authored andcommitted
refs/ref-cache.[ch]: remove unused remove_entry_from_dir()
This function was missed in 9939b33 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 98961e4 commit 34e8a20

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

refs/ref-cache.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -212,41 +212,6 @@ struct ref_entry *find_ref_entry(struct ref_dir *dir, const char *refname)
212212
return (entry->flag & REF_DIR) ? NULL : entry;
213213
}
214214

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-
250215
int add_ref_entry(struct ref_dir *dir, struct ref_entry *ref)
251216
{
252217
dir = find_containing_dir(dir, ref->name, 1);

refs/ref-cache.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,22 +199,6 @@ void free_ref_cache(struct ref_cache *cache);
199199
*/
200200
void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry);
201201

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-
218202
/*
219203
* Add a ref_entry to the ref_dir (unsorted), recursing into
220204
* subdirectories as necessary. dir must represent the top-level

0 commit comments

Comments
 (0)