MCPcopy Index your code
hub / github.com/git/git / add_patterns_from_buffer

Function add_patterns_from_buffer

dir.c:1226–1254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1224}
1225
1226int add_patterns_from_buffer(char *buf, size_t size,
1227 const char *base, int baselen,
1228 struct pattern_list *pl)
1229{
1230 char *orig = buf;
1231 int i, lineno = 1;
1232 char *entry;
1233
1234 hashmap_init(&pl->recursive_hashmap, pl_hashmap_cmp, NULL, 0);
1235 hashmap_init(&pl->parent_hashmap, pl_hashmap_cmp, NULL, 0);
1236
1237 if (skip_utf8_bom(&buf, size))
1238 size -= buf - orig;
1239
1240 entry = buf;
1241
1242 for (i = 0; i < size; i++) {
1243 if (buf[i] == '\n') {
1244 if (entry != buf + i && entry[0] != '#') {
1245 buf[i - (i && buf[i-1] == '\r')] = 0;
1246 trim_trailing_spaces(entry);
1247 add_pattern(entry, base, baselen, pl, lineno);
1248 }
1249 lineno++;
1250 entry = buf + i + 1;
1251 }
1252 }
1253 return 0;
1254}
1255
1256int add_patterns_from_file_to_list(const char *fname, const char *base,
1257 int baselen, struct pattern_list *pl,

Callers 3

add_patternsFunction · 0.85
cmd__path_walkFunction · 0.85

Calls 4

hashmap_initFunction · 0.85
skip_utf8_bomFunction · 0.85
trim_trailing_spacesFunction · 0.85
add_patternFunction · 0.85

Tested by 1

cmd__path_walkFunction · 0.68