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

Function convert_attrs

convert.c:1321–1364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1319static struct attr_check *check;
1320
1321void convert_attrs(struct index_state *istate,
1322 struct conv_attrs *ca, const char *path)
1323{
1324 struct attr_check_item *ccheck = NULL;
1325
1326 if (!check) {
1327 check = attr_check_initl("crlf", "ident", "filter",
1328 "eol", "text", "working-tree-encoding",
1329 NULL);
1330 user_convert_tail = &user_convert;
1331 repo_config(the_repository, read_convert_config, NULL);
1332 }
1333
1334 git_check_attr(istate, path, check);
1335 ccheck = check->items;
1336 ca->crlf_action = git_path_check_crlf(ccheck + 4);
1337 if (ca->crlf_action == CRLF_UNDEFINED)
1338 ca->crlf_action = git_path_check_crlf(ccheck + 0);
1339 ca->ident = git_path_check_ident(ccheck + 1);
1340 ca->drv = git_path_check_convert(ccheck + 2);
1341 if (ca->crlf_action != CRLF_BINARY) {
1342 enum eol eol_attr = git_path_check_eol(ccheck + 3);
1343 if (ca->crlf_action == CRLF_AUTO && eol_attr == EOL_LF)
1344 ca->crlf_action = CRLF_AUTO_INPUT;
1345 else if (ca->crlf_action == CRLF_AUTO && eol_attr == EOL_CRLF)
1346 ca->crlf_action = CRLF_AUTO_CRLF;
1347 else if (eol_attr == EOL_LF)
1348 ca->crlf_action = CRLF_TEXT_INPUT;
1349 else if (eol_attr == EOL_CRLF)
1350 ca->crlf_action = CRLF_TEXT_CRLF;
1351 }
1352 ca->working_tree_encoding = git_path_check_encoding(ccheck + 5);
1353
1354 /* Save attr and make a decision for action */
1355 ca->attr_action = ca->crlf_action;
1356 if (ca->crlf_action == CRLF_TEXT)
1357 ca->crlf_action = text_eol_is_crlf() ? CRLF_TEXT_CRLF : CRLF_TEXT_INPUT;
1358 if (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_FALSE)
1359 ca->crlf_action = CRLF_BINARY;
1360 if (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_TRUE)
1361 ca->crlf_action = CRLF_AUTO_CRLF;
1362 if (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_INPUT)
1363 ca->crlf_action = CRLF_AUTO_INPUT;
1364}
1365
1366void reset_parsed_attributes(void)
1367{

Callers 9

checkout_entry_caFunction · 0.85
convert_to_working_treeFunction · 0.85
get_convert_attr_asciiFunction · 0.85
convert_to_gitFunction · 0.85
convert_to_git_filter_fdFunction · 0.85
renormalize_bufferFunction · 0.85
get_stream_filterFunction · 0.85

Calls 9

attr_check_initlFunction · 0.85
git_check_attrFunction · 0.85
git_path_check_crlfFunction · 0.85
git_path_check_identFunction · 0.85
git_path_check_convertFunction · 0.85
git_path_check_eolFunction · 0.85
git_path_check_encodingFunction · 0.85
text_eol_is_crlfFunction · 0.85
repo_configFunction · 0.70

Tested by

no test coverage detected