diff options
Diffstat (limited to 'refs')
-rw-r--r-- | refs/files-backend.c | 39 | ||||
-rw-r--r-- | refs/refs-internal.h | 7 |
2 files changed, 8 insertions, 38 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index 2a0538dea7..4185025efa 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1724,10 +1724,9 @@ retry: goto error_return; } else if (remove_dir_recursively(&ref_file, REMOVE_DIR_EMPTY_ONLY)) { - if (verify_refname_available_dir( - refname, extras, skip, - get_loose_refs(refs), - err)) { + if (refs_verify_refname_available( + &refs->base, refname, + extras, skip, err)) { /* * The error message set by * verify_refname_available() is OK. @@ -2094,9 +2093,9 @@ static struct ref_lock *lock_ref_sha1_basic(struct files_ref_store *refs, */ if (remove_empty_directories(&ref_file)) { last_errno = errno; - if (!verify_refname_available_dir( - refname, extras, skip, - get_loose_refs(refs), err)) + if (!refs_verify_refname_available( + &refs->base, + refname, extras, skip, err)) strbuf_addf(err, "there are still refs under '%s'", refname); goto error_return; @@ -2108,9 +2107,8 @@ static struct ref_lock *lock_ref_sha1_basic(struct files_ref_store *refs, if (!resolved) { last_errno = errno; if (last_errno != ENOTDIR || - !verify_refname_available_dir( - refname, extras, skip, - get_loose_refs(refs), err)) + !refs_verify_refname_available(&refs->base, refname, + extras, skip, err)) strbuf_addf(err, "unable to resolve reference '%s': %s", refname, strerror(last_errno)); @@ -2606,26 +2604,6 @@ static int rename_tmp_log(struct files_ref_store *refs, const char *newrefname) return ret; } -static int files_verify_refname_available(struct ref_store *ref_store, - const char *newname, - const struct string_list *extras, - const struct string_list *skip, - struct strbuf *err) -{ - struct files_ref_store *refs = - files_downcast(ref_store, REF_STORE_READ, "verify_refname_available"); - struct ref_dir *packed_refs = get_packed_refs(refs); - struct ref_dir *loose_refs = get_loose_refs(refs); - - if (verify_refname_available_dir(newname, extras, skip, - packed_refs, err) || - verify_refname_available_dir(newname, extras, skip, - loose_refs, err)) - return -1; - - return 0; -} - static int write_ref_to_lockfile(struct ref_lock *lock, const unsigned char *sha1, struct strbuf *err); static int commit_ref_update(struct files_ref_store *refs, @@ -4288,7 +4266,6 @@ struct ref_storage_be refs_be_files = { files_ref_iterator_begin, files_read_raw_ref, - files_verify_refname_available, files_reflog_iterator_begin, files_for_each_reflog_ent, diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 545989ae7f..3d46131efb 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -590,12 +590,6 @@ typedef int read_raw_ref_fn(struct ref_store *ref_store, const char *refname, unsigned char *sha1, struct strbuf *referent, unsigned int *type); -typedef int verify_refname_available_fn(struct ref_store *ref_store, - const char *newname, - const struct string_list *extras, - const struct string_list *skip, - struct strbuf *err); - struct ref_storage_be { struct ref_storage_be *next; const char *name; @@ -612,7 +606,6 @@ struct ref_storage_be { ref_iterator_begin_fn *iterator_begin; read_raw_ref_fn *read_raw_ref; - verify_refname_available_fn *verify_refname_available; reflog_iterator_begin_fn *reflog_iterator_begin; for_each_reflog_ent_fn *for_each_reflog_ent; |