@@ -4481,34 +4481,6 @@ static int record_conflicted_index_entries(struct merge_options *opt)
44814481 return errs ;
44824482}
44834483
4484- static void format_submodule_conflict_suggestion (struct strbuf * msg ) {
4485- struct strbuf tmp = STRBUF_INIT ;
4486- struct string_list msg_list = STRING_LIST_INIT_DUP ;
4487- int i ;
4488-
4489- string_list_split (& msg_list , msg -> buf , '\n' , -1 );
4490- for (i = 0 ; i < msg_list .nr ; i ++ ) {
4491- if (!i )
4492- /*
4493- * TRANSLATORS: This is line item of submodule conflict message
4494- * from print_submodule_conflict_suggestion() below. For RTL
4495- * languages, the following swap is suggested:
4496- * " - %s\n" -> "%s - \n"
4497- */
4498- strbuf_addf (& tmp , _ (" - %s\n" ), msg_list .items [i ].string );
4499- else
4500- /*
4501- * TRANSLATORS: This is line item of submodule conflict message
4502- * from print_submodule_conflict_suggestion() below. For RTL
4503- * languages, the following swap is suggested:
4504- * " %s\n" -> "%s \n"
4505- */
4506- strbuf_addf (& tmp , _ (" %s\n" ), msg_list .items [i ].string );
4507- }
4508- strbuf_reset (msg );
4509- strbuf_add (msg , tmp .buf , tmp .len );
4510- }
4511-
45124484static void print_submodule_conflict_suggestion (struct string_list * csub ) {
45134485 struct string_list_item * item ;
45144486 struct strbuf msg = STRBUF_INIT ;
@@ -4530,45 +4502,41 @@ static void print_submodule_conflict_suggestion(struct string_list *csub) {
45304502 return ;
45314503 }
45324504
4533- printf (_ ("Recursive merging with submodules currently only supports "
4534- "trivial cases.\nPlease manually handle the merging of each "
4535- "conflicted submodule.\nThis can be accomplished with the following "
4536- "steps:" ));
4537- putchar ('\n' );
4538-
4505+ strbuf_add_separated_string_list (& subs , " " , csub );
45394506 for_each_string_list_item (item , csub ) {
45404507 struct conflicted_submodule_item * util = item -> util ;
4508+
45414509 /*
4542- * TRANSLATORS: This is a line of advice to resolve a merge conflict
4543- * in a submodule. The second argument is the abbreviated id of the
4544- * commit that needs to be merged.
4545- * E.g. - go to submodule (sub), and either merge commit abc1234"
4510+ * TRANSLATORS: This is a line of advice to resolve a merge
4511+ * conflict in a submodule. The first argument is the submodule
4512+ * name, and the second argument is the abbreviated id of the
4513+ * commit that needs to be merged. For example:
4514+ * - go to submodule (mysubmodule), and either merge commit abc1234"
45464515 */
4547- strbuf_addf (& tmp , _ ("go to submodule (%s), and either merge commit %s\n"
4548- "or update to an existing commit which has merged those changes" ),
4549- item -> string , util -> abbrev );
4550- format_submodule_conflict_suggestion (& tmp );
4551- strbuf_add (& msg , tmp .buf , tmp .len );
4552- strbuf_reset (& tmp );
4516+ strbuf_addf (& tmp , _ (" - go to submodule (%s), and either merge commit %s\n"
4517+ " or update to an existing commit which has merged those changes\n" ),
4518+ item -> string , util -> abbrev );
45534519 }
4554- strbuf_add_separated_string_list (& subs , " " , csub );
4555- strbuf_addstr (& tmp , _ ("come back to superproject and run:" ));
4556- strbuf_addf (& tmp , "\n\ngit add %s\n\n" , subs .buf );
4557- strbuf_addstr (& tmp , _ ("to record the above merge or update" ));
4558- format_submodule_conflict_suggestion (& tmp );
4559- strbuf_add (& msg , tmp .buf , tmp .len );
4560- strbuf_reset (& tmp );
4561-
4562- strbuf_addstr (& tmp , _ ("resolve any other conflicts in the superproject" ));
4563- format_submodule_conflict_suggestion (& tmp );
4564- strbuf_add (& msg , tmp .buf , tmp .len );
4565- strbuf_reset (& tmp );
4566-
4567- strbuf_addstr (& tmp , _ ("commit the resulting index in the superproject" ));
4568- format_submodule_conflict_suggestion (& tmp );
4569- strbuf_add (& msg , tmp .buf , tmp .len );
4520+
4521+ /*
4522+ * TRANSLATORS: This is a detailed message for resolving submodule
4523+ * conflicts. The first argument is string containing one step per
4524+ * submodule. The second is a space-separated list of submodule names.
4525+ */
4526+ strbuf_addf (& msg ,
4527+ _ ("Recursive merging with submodules currently only supports trivial cases.\n"
4528+ "Please manually handle the merging of each conflicted submodule.\n"
4529+ "This can be accomplished with the following steps:\n"
4530+ "%s"
4531+ " - come back to superproject and run:\n\n"
4532+ " git add %s\n\n"
4533+ " to record the above merge or update\n"
4534+ " - resolve any other conflicts in the superproject\n"
4535+ " - commit the resulting index in the superproject\n" ),
4536+ tmp .buf , subs .buf );
45704537
45714538 printf ("%s" , msg .buf );
4539+
45724540 strbuf_release (& subs );
45734541 strbuf_release (& tmp );
45744542 strbuf_release (& msg );
0 commit comments