summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2015-11-10 12:42:31 +0100
committerJeff King <peff@peff.net>2015-11-20 04:52:01 -0500
commit7003b3ce21e0ddf9028e124fd9add5ac2319e112 (patch)
tree6c9acf2642c175a36667b485c39f4586f0f7393d /refs.c
parentf34be46e47773d03e9d09641209121591a6b37c8 (diff)
downloadgit-7003b3ce21e0ddf9028e124fd9add5ac2319e112.tar.gz
verify_refname_available(): rename function
Rename verify_refname_available() to verify_refname_available_dir() to make the old name available for a more general purpose. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/refs.c b/refs.c
index 132eff52ca..0617e0c6b9 100644
--- a/refs.c
+++ b/refs.c
@@ -279,7 +279,7 @@ struct ref_dir {
* presence of an empty subdirectory does not block the creation of a
* similarly-named reference. (The fact that reference names with the
* same leading components can conflict *with each other* is a
- * separate issue that is regulated by verify_refname_available().)
+ * separate issue that is regulated by verify_refname_available_dir().)
*
* Please note that the name field contains the fully-qualified
* reference (or subdirectory) name. Space could be saved by only
@@ -911,11 +911,11 @@ static int nonmatching_ref_fn(struct ref_entry *entry, void *vdata)
*
* extras and skip must be sorted.
*/
-static int verify_refname_available(const char *refname,
- const struct string_list *extras,
- const struct string_list *skip,
- struct ref_dir *dir,
- struct strbuf *err)
+static int verify_refname_available_dir(const char *refname,
+ const struct string_list *extras,
+ const struct string_list *skip,
+ struct ref_dir *dir,
+ struct strbuf *err)
{
const char *slash;
int pos;
@@ -2465,8 +2465,8 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
strbuf_git_path(&orig_ref_file, "%s", orig_refname);
if (remove_empty_directories(&orig_ref_file)) {
last_errno = errno;
- if (!verify_refname_available(orig_refname, extras, skip,
- get_loose_refs(&ref_cache), err))
+ if (!verify_refname_available_dir(orig_refname, extras, skip,
+ get_loose_refs(&ref_cache), err))
strbuf_addf(err, "there are still refs under '%s'",
orig_refname);
goto error_return;
@@ -2479,8 +2479,8 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
if (!refname) {
last_errno = errno;
if (last_errno != ENOTDIR ||
- !verify_refname_available(orig_refname, extras, skip,
- get_loose_refs(&ref_cache), err))
+ !verify_refname_available_dir(orig_refname, extras, skip,
+ get_loose_refs(&ref_cache), err))
strbuf_addf(err, "unable to resolve reference %s: %s",
orig_refname, strerror(last_errno));
@@ -2493,8 +2493,8 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
* our refname.
*/
if (is_null_oid(&lock->old_oid) &&
- verify_refname_available(refname, extras, skip,
- get_packed_refs(&ref_cache), err)) {
+ verify_refname_available_dir(refname, extras, skip,
+ get_packed_refs(&ref_cache), err)) {
last_errno = ENOTDIR;
goto error_return;
}
@@ -3127,10 +3127,10 @@ static int rename_ref_available(const char *oldname, const char *newname)
int ret;
string_list_insert(&skip, oldname);
- ret = !verify_refname_available(newname, NULL, &skip,
- get_packed_refs(&ref_cache), &err)
- && !verify_refname_available(newname, NULL, &skip,
- get_loose_refs(&ref_cache), &err);
+ ret = !verify_refname_available_dir(newname, NULL, &skip,
+ get_packed_refs(&ref_cache), &err)
+ && !verify_refname_available_dir(newname, NULL, &skip,
+ get_loose_refs(&ref_cache), &err);
if (!ret)
error("%s", err.buf);
@@ -4376,12 +4376,12 @@ int initial_ref_transaction_commit(struct ref_transaction *transaction,
if ((update->flags & REF_HAVE_OLD) &&
!is_null_sha1(update->old_sha1))
die("BUG: initial ref transaction with old_sha1 set");
- if (verify_refname_available(update->refname,
- &affected_refnames, NULL,
- loose_refs, err) ||
- verify_refname_available(update->refname,
- &affected_refnames, NULL,
- packed_refs, err)) {
+ if (verify_refname_available_dir(update->refname,
+ &affected_refnames, NULL,
+ loose_refs, err) ||
+ verify_refname_available_dir(update->refname,
+ &affected_refnames, NULL,
+ packed_refs, err)) {
ret = TRANSACTION_NAME_CONFLICT;
goto cleanup;
}