diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-12-13 07:33:41 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-13 07:33:42 -0800 |
| commit | cd0a222f088992fc42cdd9bc0df4aa25474f0639 (patch) | |
| tree | aeb0b48bca35dafc3619a2918470a767edeb1455 /attr.h | |
| parent | e56c283c158a517650d770bcc8fd58bdeb8510b8 (diff) | |
| parent | 751d063f27a1d3c77ef092d4737524c55c65d972 (diff) | |
| download | git-cd0a222f088992fc42cdd9bc0df4aa25474f0639.tar.gz | |
Merge branch 'es/oss-fuzz'
Backport oss-fuzz tests for us to our codebase.
* es/oss-fuzz:
fuzz: port fuzz-url-decode-mem from OSS-Fuzz
fuzz: port fuzz-parse-attr-line from OSS-Fuzz
fuzz: port fuzz-credential-from-url-gently from OSS-Fuzz
Diffstat (limited to 'attr.h')
| -rw-r--r-- | attr.h | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -240,4 +240,47 @@ int git_attr_system_is_enabled(void); extern char *git_attr_tree; +/* + * Exposed for fuzz-testing only. + */ + +/* What does a matched pattern decide? */ +struct attr_state { + const struct git_attr *attr; + const char *setto; +}; + +struct pattern { + const char *pattern; + int patternlen; + int nowildcardlen; + unsigned flags; /* PATTERN_FLAG_* */ +}; + +/* + * One rule, as from a .gitattributes file. + * + * If is_macro is true, then u.attr is a pointer to the git_attr being + * defined. + * + * If is_macro is false, then u.pat is the filename pattern to which the + * rule applies. + * + * In either case, num_attr is the number of attributes affected by + * this rule, and state is an array listing them. The attributes are + * listed as they appear in the file (macros unexpanded). + */ +struct match_attr { + union { + struct pattern pat; + const struct git_attr *attr; + } u; + char is_macro; + size_t num_attr; + struct attr_state state[FLEX_ARRAY]; +}; + +struct match_attr *parse_attr_line(const char *line, const char *src, + int lineno, unsigned flags); + #endif /* ATTR_H */ |
