@@ -334,7 +334,9 @@ static void output(struct merge_options *opt, int v, const char *fmt, ...)
334
334
flush_output (opt );
335
335
}
336
336
337
- static void output_commit_title (struct merge_options * opt , struct commit * commit )
337
+ static void repo_output_commit_title (struct merge_options * opt ,
338
+ struct repository * repo ,
339
+ struct commit * commit )
338
340
{
339
341
struct merge_remote_desc * desc ;
340
342
@@ -343,23 +345,29 @@ static void output_commit_title(struct merge_options *opt, struct commit *commit
343
345
if (desc )
344
346
strbuf_addf (& opt -> obuf , "virtual %s\n" , desc -> name );
345
347
else {
346
- strbuf_add_unique_abbrev (& opt -> obuf , & commit -> object .oid ,
347
- DEFAULT_ABBREV );
348
+ strbuf_repo_add_unique_abbrev (& opt -> obuf , repo ,
349
+ & commit -> object .oid ,
350
+ DEFAULT_ABBREV );
348
351
strbuf_addch (& opt -> obuf , ' ' );
349
- if (parse_commit ( commit ) != 0 )
352
+ if (repo_parse_commit ( repo , commit ) != 0 )
350
353
strbuf_addstr (& opt -> obuf , _ ("(bad commit)\n" ));
351
354
else {
352
355
const char * title ;
353
- const char * msg = get_commit_buffer ( commit , NULL );
356
+ const char * msg = repo_get_commit_buffer ( repo , commit , NULL );
354
357
int len = find_commit_subject (msg , & title );
355
358
if (len )
356
359
strbuf_addf (& opt -> obuf , "%.*s\n" , len , title );
357
- unuse_commit_buffer ( commit , msg );
360
+ repo_unuse_commit_buffer ( repo , commit , msg );
358
361
}
359
362
}
360
363
flush_output (opt );
361
364
}
362
365
366
+ static void output_commit_title (struct merge_options * opt , struct commit * commit )
367
+ {
368
+ repo_output_commit_title (opt , the_repository , commit );
369
+ }
370
+
363
371
static int add_cacheinfo (struct merge_options * opt ,
364
372
const struct diff_filespec * blob ,
365
373
const char * path , int stage , int refresh , int options )
@@ -1149,14 +1157,14 @@ static int find_first_merges(struct repository *repo,
1149
1157
return result -> nr ;
1150
1158
}
1151
1159
1152
- static void print_commit (struct commit * commit )
1160
+ static void print_commit (struct repository * repo , struct commit * commit )
1153
1161
{
1154
1162
struct strbuf sb = STRBUF_INIT ;
1155
1163
struct pretty_print_context ctx = {0 };
1156
1164
ctx .date_mode .type = DATE_NORMAL ;
1157
1165
/* FIXME: Merge this with output_commit_title() */
1158
1166
assert (!merge_remote_util (commit ));
1159
- format_commit_message ( commit , " %h: %m %s" , & sb , & ctx );
1167
+ repo_format_commit_message ( repo , commit , " %h: %m %s" , & sb , & ctx );
1160
1168
fprintf (stderr , "%s\n" , sb .buf );
1161
1169
strbuf_release (& sb );
1162
1170
}
@@ -1196,15 +1204,6 @@ static int merge_submodule(struct merge_options *opt,
1196
1204
if (is_null_oid (b ))
1197
1205
return 0 ;
1198
1206
1199
- /*
1200
- * NEEDSWORK: Remove this when all submodule object accesses are
1201
- * through explicitly specified repositores.
1202
- */
1203
- if (add_submodule_odb (path )) {
1204
- output (opt , 1 , _ ("Failed to merge submodule %s (not checked out)" ), path );
1205
- return 0 ;
1206
- }
1207
-
1208
1207
if (repo_submodule_init (& subrepo , opt -> repo , path , null_oid ())) {
1209
1208
output (opt , 1 , _ ("Failed to merge submodule %s (not checked out)" ), path );
1210
1209
return 0 ;
@@ -1229,7 +1228,7 @@ static int merge_submodule(struct merge_options *opt,
1229
1228
oidcpy (result , b );
1230
1229
if (show (opt , 3 )) {
1231
1230
output (opt , 3 , _ ("Fast-forwarding submodule %s to the following commit:" ), path );
1232
- output_commit_title (opt , commit_b );
1231
+ repo_output_commit_title (opt , & subrepo , commit_b );
1233
1232
} else if (show (opt , 2 ))
1234
1233
output (opt , 2 , _ ("Fast-forwarding submodule %s" ), path );
1235
1234
else
@@ -1242,7 +1241,7 @@ static int merge_submodule(struct merge_options *opt,
1242
1241
oidcpy (result , a );
1243
1242
if (show (opt , 3 )) {
1244
1243
output (opt , 3 , _ ("Fast-forwarding submodule %s to the following commit:" ), path );
1245
- output_commit_title (opt , commit_a );
1244
+ repo_output_commit_title (opt , & subrepo , commit_a );
1246
1245
} else if (show (opt , 2 ))
1247
1246
output (opt , 2 , _ ("Fast-forwarding submodule %s" ), path );
1248
1247
else
@@ -1274,7 +1273,7 @@ static int merge_submodule(struct merge_options *opt,
1274
1273
case 1 :
1275
1274
output (opt , 1 , _ ("Failed to merge submodule %s (not fast-forward)" ), path );
1276
1275
output (opt , 2 , _ ("Found a possible merge resolution for the submodule:\n" ));
1277
- print_commit ((struct commit * ) merges .objects [0 ].item );
1276
+ print_commit (& subrepo , (struct commit * ) merges .objects [0 ].item );
1278
1277
output (opt , 2 , _ (
1279
1278
"If this is correct simply add it to the index "
1280
1279
"for example\n"
@@ -1287,7 +1286,7 @@ static int merge_submodule(struct merge_options *opt,
1287
1286
default :
1288
1287
output (opt , 1 , _ ("Failed to merge submodule %s (multiple merges found)" ), path );
1289
1288
for (i = 0 ; i < merges .nr ; i ++ )
1290
- print_commit ((struct commit * ) merges .objects [i ].item );
1289
+ print_commit (& subrepo , (struct commit * ) merges .objects [i ].item );
1291
1290
}
1292
1291
1293
1292
object_array_clear (& merges );
0 commit comments