@@ -582,9 +582,10 @@ static int contents_atom_parser(struct ref_format *format, struct used_atom *ato
582
582
atom -> u .contents .option = C_BARE ;
583
583
else if (!strcmp (arg , "body" ))
584
584
atom -> u .contents .option = C_BODY ;
585
- else if (!strcmp (arg , "size" ))
585
+ else if (!strcmp (arg , "size" )) {
586
+ atom -> type = FIELD_ULONG ;
586
587
atom -> u .contents .option = C_LENGTH ;
587
- else if (!strcmp (arg , "signature" ))
588
+ } else if (!strcmp (arg , "signature" ))
588
589
atom -> u .contents .option = C_SIG ;
589
590
else if (!strcmp (arg , "subject" ))
590
591
atom -> u .contents .option = C_SUB ;
@@ -690,9 +691,10 @@ static int raw_atom_parser(struct ref_format *format UNUSED,
690
691
{
691
692
if (!arg )
692
693
atom -> u .raw_data .option = RAW_BARE ;
693
- else if (!strcmp (arg , "size" ))
694
+ else if (!strcmp (arg , "size" )) {
695
+ atom -> type = FIELD_ULONG ;
694
696
atom -> u .raw_data .option = RAW_LENGTH ;
695
- else
697
+ } else
696
698
return err_bad_arg (err , "raw" , arg );
697
699
return 0 ;
698
700
}
@@ -1857,7 +1859,8 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
1857
1859
v -> s = xmemdupz (buf , buf_size );
1858
1860
v -> s_size = buf_size ;
1859
1861
} else if (atom -> u .raw_data .option == RAW_LENGTH ) {
1860
- v -> s = xstrfmt ("%" PRIuMAX , (uintmax_t )buf_size );
1862
+ v -> value = buf_size ;
1863
+ v -> s = xstrfmt ("%" PRIuMAX , v -> value );
1861
1864
}
1862
1865
continue ;
1863
1866
}
@@ -1883,9 +1886,10 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
1883
1886
v -> s = strbuf_detach (& sb , NULL );
1884
1887
} else if (atom -> u .contents .option == C_BODY_DEP )
1885
1888
v -> s = xmemdupz (bodypos , bodylen );
1886
- else if (atom -> u .contents .option == C_LENGTH )
1887
- v -> s = xstrfmt ("%" PRIuMAX , (uintmax_t )strlen (subpos ));
1888
- else if (atom -> u .contents .option == C_BODY )
1889
+ else if (atom -> u .contents .option == C_LENGTH ) {
1890
+ v -> value = strlen (subpos );
1891
+ v -> s = xstrfmt ("%" PRIuMAX , v -> value );
1892
+ } else if (atom -> u .contents .option == C_BODY )
1889
1893
v -> s = xmemdupz (bodypos , nonsiglen );
1890
1894
else if (atom -> u .contents .option == C_SIG )
1891
1895
v -> s = xmemdupz (sigpos , siglen );
@@ -2265,6 +2269,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
2265
2269
2266
2270
v -> s_size = ATOM_SIZE_UNSPECIFIED ;
2267
2271
v -> handler = append_atom ;
2272
+ v -> value = 0 ;
2268
2273
v -> atom = atom ;
2269
2274
2270
2275
if (* name == '*' ) {
0 commit comments