@@ -1076,6 +1076,20 @@ static struct commit_list *reduce_parents(struct commit *head_commit,
1076
1076
return remoteheads ;
1077
1077
}
1078
1078
1079
+ static void prepare_merge_message (struct strbuf * merge_names , struct strbuf * merge_msg )
1080
+ {
1081
+ struct fmt_merge_msg_opts opts ;
1082
+
1083
+ memset (& opts , 0 , sizeof (opts ));
1084
+ opts .add_title = !have_message ;
1085
+ opts .shortlog_len = shortlog_len ;
1086
+ opts .credit_people = (0 < option_edit );
1087
+
1088
+ fmt_merge_msg (merge_names , merge_msg , & opts );
1089
+ if (merge_msg -> len )
1090
+ strbuf_setlen (merge_msg , merge_msg -> len - 1 );
1091
+ }
1092
+
1079
1093
static struct commit_list * collect_parents (struct commit * head_commit ,
1080
1094
int * head_subsumed ,
1081
1095
int argc , const char * * argv )
@@ -1248,20 +1262,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1248
1262
1249
1263
if (!have_message || shortlog_len ) {
1250
1264
struct strbuf merge_names = STRBUF_INIT ;
1251
- struct fmt_merge_msg_opts opts ;
1252
1265
1253
1266
for (p = remoteheads ; p ; p = p -> next )
1254
1267
merge_name (merge_remote_util (p -> item )-> name , & merge_names );
1255
-
1256
- memset (& opts , 0 , sizeof (opts ));
1257
- opts .add_title = !have_message ;
1258
- opts .shortlog_len = shortlog_len ;
1259
- opts .credit_people = (0 < option_edit );
1260
-
1261
- fmt_merge_msg (& merge_names , & merge_msg , & opts );
1262
- if (merge_msg .len )
1263
- strbuf_setlen (& merge_msg , merge_msg .len - 1 );
1264
-
1268
+ prepare_merge_message (& merge_names , & merge_msg );
1265
1269
strbuf_release (& merge_names );
1266
1270
}
1267
1271
}
0 commit comments