summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2015-07-22 14:05:33 -0700
committerJunio C Hamano <gitster@pobox.com>2015-07-27 09:21:31 -0700
commitcd377f45c9d06e8ab3e87d5a687ed22ab34e1c48 (patch)
tree6a159b29d6f32850e05efeaf5c8f07491cf83177 /refs.h
parent53a8555ee4db43534990126a14f0840f92aff898 (diff)
downloadgit-cd377f45c9d06e8ab3e87d5a687ed22ab34e1c48.tar.gz
refs: loosen restriction on wildcard "*" refspecsjk/refspec-parse-wildcard
Loosen restrictions on refspecs by allowing patterns that have a "*" within a component instead of only as the whole component. Remove the logic to accept a single "*" as a whole component from check_refname_format(), and implement an extended form of that logic in check_refname_component(). Pass the pointer to the flags argument to the latter, as it has to clear REFNAME_REFSPEC_PATTERN bit when it sees "*". Teach check_refname_component() function to allow an asterisk "*" only when REFNAME_REFSPEC_PATTERN is set in the flags, and drop the bit after seeing a "*", to ensure that one side of a refspec contains at most one asterisk. This will allow us to accept refspecs such as `for/bar*:foo/baz*`. Any refspec which functioned before shall continue functioning with the new logic. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/refs.h b/refs.h
index cf642e6ddc..417f2c8ff2 100644
--- a/refs.h
+++ b/refs.h
@@ -224,8 +224,8 @@ extern int for_each_reflog(each_ref_fn, void *);
* to the rules described in Documentation/git-check-ref-format.txt.
* If REFNAME_ALLOW_ONELEVEL is set in flags, then accept one-level
* reference names. If REFNAME_REFSPEC_PATTERN is set in flags, then
- * allow a "*" wildcard character in place of one of the name
- * components. No leading or repeated slashes are accepted.
+ * allow a single "*" wildcard character in the refspec. No leading or
+ * repeated slashes are accepted.
*/
extern int check_refname_format(const char *refname, int flags);