@@ -202,36 +202,10 @@ static void shortlog(const char *name, unsigned char *sha1,
202
202
string_list_clear (& subjects , 0 );
203
203
}
204
204
205
- static int do_fmt_merge_msg ( int merge_summary , struct strbuf * in ,
206
- struct strbuf * out ) {
207
- int limit = 20 , i = 0 , pos = 0 ;
205
+ static void do_fmt_merge_msg_title ( struct strbuf * out ,
206
+ const char * current_branch ) {
207
+ int i = 0 ;
208
208
char * sep = "" ;
209
- unsigned char head_sha1 [20 ];
210
- const char * current_branch ;
211
-
212
- /* get current branch */
213
- current_branch = resolve_ref ("HEAD" , head_sha1 , 1 , NULL );
214
- if (!current_branch )
215
- die ("No current branch" );
216
- if (!prefixcmp (current_branch , "refs/heads/" ))
217
- current_branch += 11 ;
218
-
219
- /* get a line */
220
- while (pos < in -> len ) {
221
- int len ;
222
- char * newline , * p = in -> buf + pos ;
223
-
224
- newline = strchr (p , '\n' );
225
- len = newline ? newline - p : strlen (p );
226
- pos += len + !!newline ;
227
- i ++ ;
228
- p [len ] = 0 ;
229
- if (handle_line (p ))
230
- die ("Error in line %d: %.*s" , i , len , p );
231
- }
232
-
233
- if (!srcs .nr )
234
- return 0 ;
235
209
236
210
strbuf_addstr (out , "Merge " );
237
211
for (i = 0 ; i < srcs .nr ; i ++ ) {
@@ -279,6 +253,39 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
279
253
strbuf_addch (out , '\n' );
280
254
else
281
255
strbuf_addf (out , " into %s\n" , current_branch );
256
+ }
257
+
258
+ static int do_fmt_merge_msg (int merge_summary , struct strbuf * in ,
259
+ struct strbuf * out ) {
260
+ int limit = 20 , i = 0 , pos = 0 ;
261
+ unsigned char head_sha1 [20 ];
262
+ const char * current_branch ;
263
+
264
+ /* get current branch */
265
+ current_branch = resolve_ref ("HEAD" , head_sha1 , 1 , NULL );
266
+ if (!current_branch )
267
+ die ("No current branch" );
268
+ if (!prefixcmp (current_branch , "refs/heads/" ))
269
+ current_branch += 11 ;
270
+
271
+ /* get a line */
272
+ while (pos < in -> len ) {
273
+ int len ;
274
+ char * newline , * p = in -> buf + pos ;
275
+
276
+ newline = strchr (p , '\n' );
277
+ len = newline ? newline - p : strlen (p );
278
+ pos += len + !!newline ;
279
+ i ++ ;
280
+ p [len ] = 0 ;
281
+ if (handle_line (p ))
282
+ die ("Error in line %d: %.*s" , i , len , p );
283
+ }
284
+
285
+ if (!srcs .nr )
286
+ return 0 ;
287
+
288
+ do_fmt_merge_msg_title (out , current_branch );
282
289
283
290
if (merge_summary ) {
284
291
struct commit * head ;
0 commit comments