Change check_ref_format() to take a flags argument
Change check_ref_format() to take a flags argument that indicates what is acceptable in the reference name (analogous to "git check-ref-format"'s "--allow-onelevel" and "--refspec-pattern"). This is more convenient for callers and also fixes a failure in the test suite (and likely elsewhere in the code) by enabling "onelevel" and "refspec-pattern" to be allowed independently of each other. Also rename check_ref_format() to check_refname_format() to make it obvious that it deals with refnames rather than references themselves. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
9224b73be0
commit
8d9c50105f
@ -94,7 +94,7 @@ static int replace_object(const char *object_ref, const char *replace_ref,
|
||||
"refs/replace/%s",
|
||||
sha1_to_hex(object)) > sizeof(ref) - 1)
|
||||
die("replace ref name too long: %.*s...", 50, ref);
|
||||
if (check_ref_format(ref))
|
||||
if (check_refname_format(ref, 0))
|
||||
die("'%s' is not a valid ref name.", ref);
|
||||
|
||||
if (!resolve_ref(ref, prev, 1, NULL))
|
||||
|
Reference in New Issue
Block a user