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

Function convert_commit_extra_headers

commit.c:1418–1449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1416}
1417
1418static int convert_commit_extra_headers(const struct commit_extra_header *orig,
1419 struct commit_extra_header **result)
1420{
1421 const struct git_hash_algo *compat = the_repository->compat_hash_algo;
1422 const struct git_hash_algo *algo = the_repository->hash_algo;
1423 struct commit_extra_header *extra = NULL, **tail = &extra;
1424 struct strbuf out = STRBUF_INIT;
1425 while (orig) {
1426 struct commit_extra_header *new;
1427 CALLOC_ARRAY(new, 1);
1428 if (!strcmp(orig->key, "mergetag")) {
1429 if (convert_object_file(the_repository, &out, algo, compat,
1430 orig->value, orig->len,
1431 OBJ_TAG, 1)) {
1432 free(new);
1433 free_commit_extra_headers(extra);
1434 return -1;
1435 }
1436 new->key = xstrdup("mergetag");
1437 new->value = strbuf_detach(&out, &new->len);
1438 } else {
1439 new->key = xstrdup(orig->key);
1440 new->len = orig->len;
1441 new->value = xmemdupz(orig->value, orig->len);
1442 }
1443 *tail = new;
1444 tail = &new->next;
1445 orig = orig->next;
1446 }
1447 *result = extra;
1448 return 0;
1449}
1450
1451static void add_extra_header(struct strbuf *buffer,
1452 const struct commit_extra_header *extra)

Callers 1

commit_tree_extendedFunction · 0.85

Calls 5

convert_object_fileFunction · 0.85
xstrdupFunction · 0.85
strbuf_detachFunction · 0.85
xmemdupzFunction · 0.85

Tested by

no test coverage detected