Skip to content

Commit 7003b3c

Browse files
rsahlbergpeff
authored andcommitted
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 <[email protected]> Signed-off-by: David Turner <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent f34be46 commit 7003b3c

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

refs.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ struct ref_dir {
279279
* presence of an empty subdirectory does not block the creation of a
280280
* similarly-named reference. (The fact that reference names with the
281281
* same leading components can conflict *with each other* is a
282-
* separate issue that is regulated by verify_refname_available().)
282+
* separate issue that is regulated by verify_refname_available_dir().)
283283
*
284284
* Please note that the name field contains the fully-qualified
285285
* 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)
911911
*
912912
* extras and skip must be sorted.
913913
*/
914-
static int verify_refname_available(const char *refname,
915-
const struct string_list *extras,
916-
const struct string_list *skip,
917-
struct ref_dir *dir,
918-
struct strbuf *err)
914+
static int verify_refname_available_dir(const char *refname,
915+
const struct string_list *extras,
916+
const struct string_list *skip,
917+
struct ref_dir *dir,
918+
struct strbuf *err)
919919
{
920920
const char *slash;
921921
int pos;
@@ -2465,8 +2465,8 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
24652465
strbuf_git_path(&orig_ref_file, "%s", orig_refname);
24662466
if (remove_empty_directories(&orig_ref_file)) {
24672467
last_errno = errno;
2468-
if (!verify_refname_available(orig_refname, extras, skip,
2469-
get_loose_refs(&ref_cache), err))
2468+
if (!verify_refname_available_dir(orig_refname, extras, skip,
2469+
get_loose_refs(&ref_cache), err))
24702470
strbuf_addf(err, "there are still refs under '%s'",
24712471
orig_refname);
24722472
goto error_return;
@@ -2479,8 +2479,8 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
24792479
if (!refname) {
24802480
last_errno = errno;
24812481
if (last_errno != ENOTDIR ||
2482-
!verify_refname_available(orig_refname, extras, skip,
2483-
get_loose_refs(&ref_cache), err))
2482+
!verify_refname_available_dir(orig_refname, extras, skip,
2483+
get_loose_refs(&ref_cache), err))
24842484
strbuf_addf(err, "unable to resolve reference %s: %s",
24852485
orig_refname, strerror(last_errno));
24862486

@@ -2493,8 +2493,8 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
24932493
* our refname.
24942494
*/
24952495
if (is_null_oid(&lock->old_oid) &&
2496-
verify_refname_available(refname, extras, skip,
2497-
get_packed_refs(&ref_cache), err)) {
2496+
verify_refname_available_dir(refname, extras, skip,
2497+
get_packed_refs(&ref_cache), err)) {
24982498
last_errno = ENOTDIR;
24992499
goto error_return;
25002500
}
@@ -3127,10 +3127,10 @@ static int rename_ref_available(const char *oldname, const char *newname)
31273127
int ret;
31283128

31293129
string_list_insert(&skip, oldname);
3130-
ret = !verify_refname_available(newname, NULL, &skip,
3131-
get_packed_refs(&ref_cache), &err)
3132-
&& !verify_refname_available(newname, NULL, &skip,
3133-
get_loose_refs(&ref_cache), &err);
3130+
ret = !verify_refname_available_dir(newname, NULL, &skip,
3131+
get_packed_refs(&ref_cache), &err)
3132+
&& !verify_refname_available_dir(newname, NULL, &skip,
3133+
get_loose_refs(&ref_cache), &err);
31343134
if (!ret)
31353135
error("%s", err.buf);
31363136

@@ -4376,12 +4376,12 @@ int initial_ref_transaction_commit(struct ref_transaction *transaction,
43764376
if ((update->flags & REF_HAVE_OLD) &&
43774377
!is_null_sha1(update->old_sha1))
43784378
die("BUG: initial ref transaction with old_sha1 set");
4379-
if (verify_refname_available(update->refname,
4380-
&affected_refnames, NULL,
4381-
loose_refs, err) ||
4382-
verify_refname_available(update->refname,
4383-
&affected_refnames, NULL,
4384-
packed_refs, err)) {
4379+
if (verify_refname_available_dir(update->refname,
4380+
&affected_refnames, NULL,
4381+
loose_refs, err) ||
4382+
verify_refname_available_dir(update->refname,
4383+
&affected_refnames, NULL,
4384+
packed_refs, err)) {
43854385
ret = TRANSACTION_NAME_CONFLICT;
43864386
goto cleanup;
43874387
}

0 commit comments

Comments
 (0)