git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Calvin Wan <calvinwan@google.com>,
	Elijah Newren <newren@gmail.com>,
	Elijah Newren <newren@gmail.com>
Subject: [PATCH v2 3/3] merge-ort: provide helpful submodule update message when possible
Date: Wed, 17 Aug 2022 06:33:48 +0000	[thread overview]
Message-ID: <80207d183343e6f1397abdb70fee68bfb26f1756.1660718028.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1325.v2.git.1660718028.gitgitgadget@gmail.com>

From: Elijah Newren <newren@gmail.com>

In commit 4057523a40 ("submodule merge: update conflict error message",
2022-08-04), a more detailed message was provided when submodules
conflict, in order to help users know how to resolve those conflicts.
There were a couple situations for which a different message would be
more appropriate, but that commit left handling those for future work.
Unfortunately, that commit would check if any submodules were of the
type that it didn't know how to explain, and, if so, would avoid
providing the more detailed explanation even for the submodules it did
know how to explain.

Change this to have the code print the helpful messages for the subset
of submodules it knows how to explain.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 merge-ort.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/merge-ort.c b/merge-ort.c
index 0a935a8135f..404f05e32d6 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -4490,21 +4490,17 @@ static void print_submodule_conflict_suggestion(struct string_list *csub) {
 	if (!csub->nr)
 		return;
 
-	/*
-	 * NEEDSWORK: The steps to resolve these errors deserve a more
-	 * detailed explanation than what is currently printed below.
-	 */
+	strbuf_add_separated_string_list(&subs, " ", csub);
 	for_each_string_list_item(item, csub) {
 		struct conflicted_submodule_item *util = item->util;
 
+		/*
+		 * NEEDSWORK: The steps to resolve these errors deserve a more
+		 * detailed explanation than what is currently printed below.
+		 */
 		if (util->flag == CONFLICT_SUBMODULE_NOT_INITIALIZED ||
-			util->flag == CONFLICT_SUBMODULE_HISTORY_NOT_AVAILABLE)
-			return;
-	}
-
-	strbuf_add_separated_string_list(&subs, " ", csub);
-	for_each_string_list_item(item, csub) {
-		struct conflicted_submodule_item *util = item->util;
+		    util->flag == CONFLICT_SUBMODULE_HISTORY_NOT_AVAILABLE)
+			continue;
 
 		/*
 		 * TRANSLATORS: This is a line of advice to resolve a merge
-- 
gitgitgadget

  parent reply	other threads:[~2022-08-17  6:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  0:27 [PATCH 0/3] Fixups for cw/submodule-merge-messages Elijah Newren via GitGitGadget
2022-08-17  0:27 ` [PATCH 1/3] merge-ort: remove translator lego in new "submodule conflict suggestion" Elijah Newren via GitGitGadget
2022-08-17  0:28 ` [PATCH 2/3] merge-ort: add comment to avoid surprise with new sub_flag variable Elijah Newren via GitGitGadget
2022-08-17  0:28 ` [PATCH 3/3] merge-ort: provide helpful submodule update message when possible Elijah Newren via GitGitGadget
2022-08-17  5:37 ` [PATCH 0/3] Fixups for cw/submodule-merge-messages Junio C Hamano
2022-08-17  6:33 ` [PATCH v2 " Elijah Newren via GitGitGadget
2022-08-17  6:33   ` [PATCH v2 1/3] merge-ort: remove translator lego in new "submodule conflict suggestion" Elijah Newren via GitGitGadget
2022-08-17  6:33   ` [PATCH v2 2/3] merge-ort: add comment to avoid surprise with new sub_flag variable Elijah Newren via GitGitGadget
2022-08-17 21:45     ` Junio C Hamano
2022-08-18  6:36       ` Elijah Newren
2022-08-17  6:33   ` Elijah Newren via GitGitGadget [this message]
2022-08-17 21:31   ` [PATCH v2 0/3] Fixups for cw/submodule-merge-messages Junio C Hamano
2022-08-18  7:15   ` [PATCH v3 " Elijah Newren via GitGitGadget
2022-08-18  7:15     ` [PATCH v3 1/3] merge-ort: remove translator lego in new "submodule conflict suggestion" Elijah Newren via GitGitGadget
2022-08-18  7:15     ` [PATCH v3 2/3] merge-ort: avoid surprise with new sub_flag variable Elijah Newren via GitGitGadget
2022-08-18  7:15     ` [PATCH v3 3/3] merge-ort: provide helpful submodule update message when possible Elijah Newren via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80207d183343e6f1397abdb70fee68bfb26f1756.1660718028.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=calvinwan@google.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).