MCPcopy Create free account
hub / github.com/git/git / hashmap_contains_parent

Function hashmap_contains_parent

dir.c:945–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

943}
944
945int 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
972void add_pattern(const char *string, const char *base,
973 int baselen, struct pattern_list *pl, int srcpos)

Callers 3

write_cone_to_fileFunction · 0.85
add_patterns_cone_modeFunction · 0.85

Calls 4

strbuf_setlenFunction · 0.85
strbuf_addchFunction · 0.85
strbuf_addstrFunction · 0.85
hashmap_contains_pathFunction · 0.85

Tested by

no test coverage detected