git check-ref-format: add options --allow-onelevel and --refspec-pattern
authorMichael Haggerty <mhagger@alum.mit.edu>
Thu, 15 Sep 2011 21:10:23 +0000 (23:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Oct 2011 20:45:29 +0000 (13:45 -0700)
Also add tests of the new options. (Actually, one big reason to add
the new options is to make it easy to test check_ref_format(), though
the options should also be useful to other scripts.)

Interpret the result of check_ref_format() based on which types of
refnames are allowed. However, because check_ref_format() can only
return a single value, one test case is still broken. Specifically,
the case "git check-ref-format --onelevel '*'" incorrectly succeeds
because check_ref_format() returns CHECK_REF_FORMAT_ONELEVEL for this
refname even though the refname is also CHECK_REF_FORMAT_WILDCARD.
The type of check that leads to this failure is used elsewhere in
"real" code and could lead to bugs; it will be fixed over the next few
commits.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found