| 35 | }; |
| 36 | |
| 37 | static void output_pattern(const char *path, struct path_pattern *pattern) |
| 38 | { |
| 39 | const char *bang = (pattern && pattern->flags & PATTERN_FLAG_NEGATIVE) ? "!" : ""; |
| 40 | const char *slash = (pattern && pattern->flags & PATTERN_FLAG_MUSTBEDIR) ? "/" : ""; |
| 41 | if (!nul_term_line) { |
| 42 | if (!verbose) { |
| 43 | write_name_quoted(path, stdout, '\n'); |
| 44 | } else { |
| 45 | if (pattern) { |
| 46 | quote_c_style(pattern->pl->src, NULL, stdout, 0); |
| 47 | printf(":%d:%s%s%s\t", |
| 48 | pattern->srcpos, |
| 49 | bang, pattern->pattern, slash); |
| 50 | } |
| 51 | else { |
| 52 | printf("::\t"); |
| 53 | } |
| 54 | quote_c_style(path, NULL, stdout, 0); |
| 55 | fputc('\n', stdout); |
| 56 | } |
| 57 | } else { |
| 58 | if (!verbose) { |
| 59 | printf("%s%c", path, '\0'); |
| 60 | } else { |
| 61 | if (pattern) |
| 62 | printf("%s%c%d%c%s%s%s%c%s%c", |
| 63 | pattern->pl->src, '\0', |
| 64 | pattern->srcpos, '\0', |
| 65 | bang, pattern->pattern, slash, '\0', |
| 66 | path, '\0'); |
| 67 | else |
| 68 | printf("%c%c%c%s%c", '\0', '\0', '\0', path, '\0'); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | static int check_ignore(struct dir_struct *dir, |
| 74 | const char *prefix, int argc, const char **argv) |
no test coverage detected