1262
return sigs[0].start != NULL;
1263
}
1264
1265
-static void handle_signed_tag(struct commit *parent, struct commit_extra_header ***tail)
1265
+static void handle_signed_tag(const struct commit *parent, struct commit_extra_header ***tail)
1266
{
1267
struct merge_remote_desc *desc;
1268
struct commit_extra_header *mergetag;
1359
signature_check_clear(&signature_check);
1360
}
1361
1362
-void append_merge_tag_headers(struct commit_list *parents,
1362
+void append_merge_tag_headers(const struct commit_list *parents,
1363
struct commit_extra_header ***tail)
1364
{
1365
while (parents) {
1366
- struct commit *parent = parents->item;
1366
+ const struct commit *parent = parents->item;
1367
handle_signed_tag(parent, tail);
1368
parents = parents->next;
1369
}
1370
}
1371
1372
-static int convert_commit_extra_headers(struct commit_extra_header *orig,
1372
+static int convert_commit_extra_headers(const struct commit_extra_header *orig,
1373
struct commit_extra_header **result)
1374
{
1375
const struct git_hash_algo *compat = the_repository->compat_hash_algo;
1403
}
1404
1405
static void add_extra_header(struct strbuf *buffer,
1406
- struct commit_extra_header *extra)
1406
+ const struct commit_extra_header *extra)
1407
{
1408
strbuf_addstr(buffer, extra->key);
1409
if (extra->len)
1517
}
1518
1519
int commit_tree(const char *msg, size_t msg_len, const struct object_id *tree,
1520
- struct commit_list *parents, struct object_id *ret,
1520
+ const struct commit_list *parents, struct object_id *ret,
1521
const char *author, const char *sign_commit)
1522
{
1523
struct commit_extra_header *extra = NULL, **tail = &extra;
1649
const struct object_id *tree,
1650
const struct object_id *parents, size_t parents_len,
1651
const char *author, const char *committer,
1652
- struct commit_extra_header *extra)
1652
+ const struct commit_extra_header *extra)
1653
{
1654
int encoding_is_utf8;
1655
size_t i;
1690
1691
int commit_tree_extended(const char *msg, size_t msg_len,
1692
const struct object_id *tree,
1693
- struct commit_list *parents, struct object_id *ret,
1693
+ const struct commit_list *parents, struct object_id *ret,
1694
const char *author, const char *committer,
1695
const char *sign_commit,
1696
- struct commit_extra_header *extra)
1696
+ const struct commit_extra_header *extra)
1697
{
1698
struct repository *r = the_repository;
1699
int result = 0;
1715
nparents = commit_list_count(parents);
1716
CALLOC_ARRAY(parent_buf, nparents);
1717
i = 0;
1718
- while (parents) {
1719
- struct commit *parent = pop_commit(&parents);
1720
- oidcpy(&parent_buf[i++], &parent->object.oid);
1721
- }
1718
+ for (const struct commit_list *p = parents; p; p = p->next)
1719
+ oidcpy(&parent_buf[i++], &p->item->object.oid);
1720
1721
write_commit_tree(&buffer, msg, msg_len, tree, parent_buf, nparents, author, committer, extra);
1722
if (sign_commit && sign_commit_to_strbuf(&sig, &buffer, sign_commit)) {
1812
define_commit_slab(merge_desc_slab, struct merge_remote_desc *);
1813
static struct merge_desc_slab merge_desc_slab = COMMIT_SLAB_INIT(1, merge_desc_slab);
1814
1817
-struct merge_remote_desc *merge_remote_util(struct commit *commit)
1815
+struct merge_remote_desc *merge_remote_util(const struct commit *commit)
1816
{
1817
return *merge_desc_slab_at(&merge_desc_slab, commit);
1818
}