зеркало из https://github.com/microsoft/git.git
create_ref_entry(): remove `check_name` option
Only one caller was using it, so move the check to that caller. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
0a0865b8f1
Коммит
c1da06c6f1
|
@ -291,7 +291,7 @@ static struct packed_ref_cache *read_packed_refs(const char *packed_refs_file)
|
||||||
oidclr(&oid);
|
oidclr(&oid);
|
||||||
flag |= REF_BAD_NAME | REF_ISBROKEN;
|
flag |= REF_BAD_NAME | REF_ISBROKEN;
|
||||||
}
|
}
|
||||||
last = create_ref_entry(refname, &oid, flag, 0);
|
last = create_ref_entry(refname, &oid, flag);
|
||||||
if (peeled == PEELED_FULLY ||
|
if (peeled == PEELED_FULLY ||
|
||||||
(peeled == PEELED_TAGS && starts_with(refname, "refs/tags/")))
|
(peeled == PEELED_TAGS && starts_with(refname, "refs/tags/")))
|
||||||
last->flag |= REF_KNOWS_PEELED;
|
last->flag |= REF_KNOWS_PEELED;
|
||||||
|
@ -415,8 +415,12 @@ static void add_packed_ref(struct files_ref_store *refs,
|
||||||
|
|
||||||
if (!is_lock_file_locked(&refs->packed_refs_lock))
|
if (!is_lock_file_locked(&refs->packed_refs_lock))
|
||||||
die("BUG: packed refs not locked");
|
die("BUG: packed refs not locked");
|
||||||
|
|
||||||
|
if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL))
|
||||||
|
die("Reference has invalid format: '%s'", refname);
|
||||||
|
|
||||||
add_ref_entry(get_packed_ref_dir(packed_ref_cache),
|
add_ref_entry(get_packed_ref_dir(packed_ref_cache),
|
||||||
create_ref_entry(refname, oid, REF_ISPACKED, 1));
|
create_ref_entry(refname, oid, REF_ISPACKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -493,7 +497,7 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
|
||||||
flag |= REF_BAD_NAME | REF_ISBROKEN;
|
flag |= REF_BAD_NAME | REF_ISBROKEN;
|
||||||
}
|
}
|
||||||
add_entry_to_dir(dir,
|
add_entry_to_dir(dir,
|
||||||
create_ref_entry(refname.buf, &oid, flag, 0));
|
create_ref_entry(refname.buf, &oid, flag));
|
||||||
}
|
}
|
||||||
strbuf_setlen(&refname, dirnamelen);
|
strbuf_setlen(&refname, dirnamelen);
|
||||||
strbuf_setlen(&path, path_baselen);
|
strbuf_setlen(&path, path_baselen);
|
||||||
|
@ -1541,7 +1545,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
|
||||||
oidcpy(&packed_entry->u.value.oid, iter->oid);
|
oidcpy(&packed_entry->u.value.oid, iter->oid);
|
||||||
} else {
|
} else {
|
||||||
packed_entry = create_ref_entry(iter->refname, iter->oid,
|
packed_entry = create_ref_entry(iter->refname, iter->oid,
|
||||||
REF_ISPACKED, 0);
|
REF_ISPACKED);
|
||||||
add_ref_entry(packed_refs, packed_entry);
|
add_ref_entry(packed_refs, packed_entry);
|
||||||
}
|
}
|
||||||
oidclr(&packed_entry->u.value.peeled);
|
oidclr(&packed_entry->u.value.peeled);
|
||||||
|
|
|
@ -32,14 +32,10 @@ struct ref_dir *get_ref_dir(struct ref_entry *entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ref_entry *create_ref_entry(const char *refname,
|
struct ref_entry *create_ref_entry(const char *refname,
|
||||||
const struct object_id *oid, int flag,
|
const struct object_id *oid, int flag)
|
||||||
int check_name)
|
|
||||||
{
|
{
|
||||||
struct ref_entry *ref;
|
struct ref_entry *ref;
|
||||||
|
|
||||||
if (check_name &&
|
|
||||||
check_refname_format(refname, REFNAME_ALLOW_ONELEVEL))
|
|
||||||
die("Reference has invalid format: '%s'", refname);
|
|
||||||
FLEX_ALLOC_STR(ref, name, refname);
|
FLEX_ALLOC_STR(ref, name, refname);
|
||||||
oidcpy(&ref->u.value.oid, oid);
|
oidcpy(&ref->u.value.oid, oid);
|
||||||
oidclr(&ref->u.value.peeled);
|
oidclr(&ref->u.value.peeled);
|
||||||
|
|
|
@ -185,8 +185,7 @@ struct ref_entry *create_dir_entry(struct ref_cache *cache,
|
||||||
int incomplete);
|
int incomplete);
|
||||||
|
|
||||||
struct ref_entry *create_ref_entry(const char *refname,
|
struct ref_entry *create_ref_entry(const char *refname,
|
||||||
const struct object_id *oid, int flag,
|
const struct object_id *oid, int flag);
|
||||||
int check_name);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a pointer to a new `ref_cache`. Its top-level starts out
|
* Return a pointer to a new `ref_cache`. Its top-level starts out
|
||||||
|
|
Загрузка…
Ссылка в новой задаче