@@ -783,29 +783,9 @@ struct format_commit_context {
783
783
size_t body_off ;
784
784
785
785
/* The following ones are relative to the result struct strbuf. */
786
- struct chunk abbrev_commit_hash ;
787
- struct chunk abbrev_tree_hash ;
788
- struct chunk abbrev_parent_hashes ;
789
786
size_t wrap_start ;
790
787
};
791
788
792
- static int add_again (struct strbuf * sb , struct chunk * chunk )
793
- {
794
- if (chunk -> len ) {
795
- strbuf_adddup (sb , chunk -> off , chunk -> len );
796
- return 1 ;
797
- }
798
-
799
- /*
800
- * We haven't seen this chunk before. Our caller is surely
801
- * going to add it the hard way now. Remember the most likely
802
- * start of the to-be-added chunk: the current end of the
803
- * struct strbuf.
804
- */
805
- chunk -> off = sb -> len ;
806
- return 0 ;
807
- }
808
-
809
789
static void parse_commit_header (struct format_commit_context * context )
810
790
{
811
791
const char * msg = context -> message ;
@@ -1147,24 +1127,16 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
1147
1127
return 1 ;
1148
1128
case 'h' : /* abbreviated commit hash */
1149
1129
strbuf_addstr (sb , diff_get_color (c -> auto_color , DIFF_COMMIT ));
1150
- if (add_again (sb , & c -> abbrev_commit_hash )) {
1151
- strbuf_addstr (sb , diff_get_color (c -> auto_color , DIFF_RESET ));
1152
- return 1 ;
1153
- }
1154
1130
strbuf_add_unique_abbrev (sb , commit -> object .oid .hash ,
1155
1131
c -> pretty_ctx -> abbrev );
1156
1132
strbuf_addstr (sb , diff_get_color (c -> auto_color , DIFF_RESET ));
1157
- c -> abbrev_commit_hash .len = sb -> len - c -> abbrev_commit_hash .off ;
1158
1133
return 1 ;
1159
1134
case 'T' : /* tree hash */
1160
1135
strbuf_addstr (sb , oid_to_hex (& commit -> tree -> object .oid ));
1161
1136
return 1 ;
1162
1137
case 't' : /* abbreviated tree hash */
1163
- if (add_again (sb , & c -> abbrev_tree_hash ))
1164
- return 1 ;
1165
1138
strbuf_add_unique_abbrev (sb , commit -> tree -> object .oid .hash ,
1166
1139
c -> pretty_ctx -> abbrev );
1167
- c -> abbrev_tree_hash .len = sb -> len - c -> abbrev_tree_hash .off ;
1168
1140
return 1 ;
1169
1141
case 'P' : /* parent hashes */
1170
1142
for (p = commit -> parents ; p ; p = p -> next ) {
@@ -1174,16 +1146,12 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
1174
1146
}
1175
1147
return 1 ;
1176
1148
case 'p' : /* abbreviated parent hashes */
1177
- if (add_again (sb , & c -> abbrev_parent_hashes ))
1178
- return 1 ;
1179
1149
for (p = commit -> parents ; p ; p = p -> next ) {
1180
1150
if (p != commit -> parents )
1181
1151
strbuf_addch (sb , ' ' );
1182
1152
strbuf_add_unique_abbrev (sb , p -> item -> object .oid .hash ,
1183
1153
c -> pretty_ctx -> abbrev );
1184
1154
}
1185
- c -> abbrev_parent_hashes .len = sb -> len -
1186
- c -> abbrev_parent_hashes .off ;
1187
1155
return 1 ;
1188
1156
case 'm' : /* left/right/bottom */
1189
1157
strbuf_addstr (sb , get_revision_mark (NULL , commit ));
0 commit comments