1356
}
1357
1358
/* See grab_values */
1359
-static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf)
1359
+static void grab_sub_body_contents(struct atom_value *val, int deref, struct expand_data *data)
1360
{
1361
int i;
1362
const char *subpos = NULL, *bodypos = NULL, *sigpos = NULL;
1363
size_t sublen = 0, bodylen = 0, nonsiglen = 0, siglen = 0;
1364
+ void *buf = data->content;
1365
1366
for (i = 0; i < used_atom_cnt; i++) {
1367
struct used_atom *atom = &used_atom[i];
1372
continue;
1373
if (deref)
1374
name++;
1374
- if (strcmp(name, "body") &&
1375
- !starts_with(name, "subject") &&
1376
- !starts_with(name, "trailers") &&
1377
- !starts_with(name, "contents"))
1375
+
1376
+ if ((data->type != OBJ_TAG &&
1377
+ data->type != OBJ_COMMIT) ||
1378
+ (strcmp(name, "body") &&
1379
+ !starts_with(name, "subject") &&
1380
+ !starts_with(name, "trailers") &&
1381
+ !starts_with(name, "contents")))
1382
continue;
1383
if (!subpos)
1384
find_subpos(buf,
1442
* pointed at by the ref itself; otherwise it is the object the
1443
* ref (which is a tag) refers to.
1444
*/
1441
-static void grab_values(struct atom_value *val, int deref, struct object *obj, void *buf)
1445
+static void grab_values(struct atom_value *val, int deref, struct object *obj, struct expand_data *data)
1446
{
1447
+ void *buf = data->content;
1448
+
1449
switch (obj->type) {
1450
case OBJ_TAG:
1451
grab_tag_values(val, deref, obj);
1446
- grab_sub_body_contents(val, deref, buf);
1452
+ grab_sub_body_contents(val, deref, data);
1453
grab_person("tagger", val, deref, buf);
1454
break;
1455
case OBJ_COMMIT:
1456
grab_commit_values(val, deref, obj);
1451
- grab_sub_body_contents(val, deref, buf);
1457
+ grab_sub_body_contents(val, deref, data);
1458
grab_person("author", val, deref, buf);
1459
grab_person("committer", val, deref, buf);
1460
break;
1684
return strbuf_addf_ret(err, -1, _("parse_object_buffer failed on %s for %s"),
1685
oid_to_hex(&oi->oid), ref->refname);
1686
}
1681
- grab_values(ref->value, deref, *obj, oi->content);
1687
+ grab_values(ref->value, deref, *obj, oi);
1688
}
1689
1690
grab_common_values(ref->value, deref, oi);