| 943 | } |
| 944 | |
| 945 | int hashmap_contains_parent(struct hashmap *map, |
| 946 | const char *path, |
| 947 | struct strbuf *buffer) |
| 948 | { |
| 949 | char *slash_pos; |
| 950 | |
| 951 | strbuf_setlen(buffer, 0); |
| 952 | |
| 953 | if (path[0] != '/') |
| 954 | strbuf_addch(buffer, '/'); |
| 955 | |
| 956 | strbuf_addstr(buffer, path); |
| 957 | |
| 958 | slash_pos = strrchr(buffer->buf, '/'); |
| 959 | |
| 960 | while (slash_pos > buffer->buf) { |
| 961 | strbuf_setlen(buffer, slash_pos - buffer->buf); |
| 962 | |
| 963 | if (hashmap_contains_path(map, buffer)) |
| 964 | return 1; |
| 965 | |
| 966 | slash_pos = strrchr(buffer->buf, '/'); |
| 967 | } |
| 968 | |
| 969 | return 0; |
| 970 | } |
| 971 | |
| 972 | void add_pattern(const char *string, const char *base, |
| 973 | int baselen, struct pattern_list *pl, int srcpos) |
no test coverage detected