Re: [PATCH v8] submodule merge: update conflict error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Calvin Wan <calvinwan@xxxxxxxxxx> writes:

> @@ -4412,6 +4459,99 @@ static int record_conflicted_index_entries(struct merge_options *opt)
>  	return errs;
>  }
>  
> +static void format_submodule_conflict_suggestion(struct strbuf *msg) {
> +	struct strbuf tmp = STRBUF_INIT;
> +	struct string_list msg_list = STRING_LIST_INIT_DUP;
> +	int i;
> +
> +	string_list_split(&msg_list, msg->buf, '\n', -1);
> +	for (i = 0; i < msg_list.nr; i++) {
> +		if (!i)
> +			/*
> +			 * TRANSLATORS: This is line item of submodule conflict message
> +			 * from print_submodule_conflict_suggestion() below. For RTL
> +			 * languages, the following swap is suggested:
> +			 *      " - %s\n" -> "%s - \n"
> +			 */
> +			strbuf_addf(&tmp, _(" - %s\n"), msg_list.items[i].string);
> +		else
> +			/*
> +			 * TRANSLATORS: This is line item of submodule conflict message
> +			 * from print_submodule_conflict_suggestion() below. For RTL
> +			 * languages, the following swap is suggested:
> +			 *      "   %s\n" -> "%s   \n"
> +			 */
> +			strbuf_addf(&tmp, _("   %s\n"), msg_list.items[i].string);
> +	}
> +	strbuf_reset(msg);
> +	strbuf_add(msg, tmp.buf, tmp.len);
> +}

Here, tmp is not released, and mst_list holds the words split out of msg.

 merge-ort.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git i/merge-ort.c w/merge-ort.c
index 4cb92bdff8..cdb53770be 100644
--- i/merge-ort.c
+++ w/merge-ort.c
@@ -4507,6 +4507,8 @@ static void format_submodule_conflict_suggestion(struct strbuf *msg) {
 	}
 	strbuf_reset(msg);
 	strbuf_add(msg, tmp.buf, tmp.len);
+	string_list_clear(&msg_list, 0);
+	strbuf_release(&tmp);
 }
 
 static void print_submodule_conflict_suggestion(struct string_list *csub) {



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux