git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 3/3] merge-ort: provide helpful submodule update message when possible

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 17, 2022, 06:33 UTC
Message-ID
<80207d183343e6f1397abdb70fee68bfb26f1756.1660718028.git.gitgitgadget@gmail.com>
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
Previous: Elijah NewrenNext: Junio C Hamano
Message 11 of 16 in “Fixups for cw/submodule-merge-messages”
  1. 0/3 Fixups for cw/submodule-merge-messagesElijah Newren via GitGitGadget, Aug 17, 2022
  2. 1/3 merge-ort: remove translator lego in new "submodule conflict suggestion"Elijah Newren via GitGitGadget, Aug 17, 2022
  3. 2/3 merge-ort: add comment to avoid surprise with new sub_flag variableElijah Newren via GitGitGadget, Aug 17, 2022
  4. 3/3 merge-ort: provide helpful submodule update message when possibleElijah Newren via GitGitGadget, Aug 17, 2022
  5. Junio C HamanoAug 17, 2022
  6. 0/3 Fixups for cw/submodule-merge-messagesElijah Newren via GitGitGadget, Aug 17, 2022
  7. 1/3 merge-ort: remove translator lego in new "submodule conflict suggestion"Elijah Newren via GitGitGadget, Aug 17, 2022
  8. 2/3 merge-ort: add comment to avoid surprise with new sub_flag variableElijah Newren via GitGitGadget, Aug 17, 2022
  9. Junio C HamanoAug 17, 2022
  10. Elijah NewrenAug 18, 2022
  11. 3/3 merge-ort: provide helpful submodule update message when possibleElijah Newren via GitGitGadget, Aug 17, 2022
  12. Junio C HamanoAug 17, 2022
  13. 0/3 Fixups for cw/submodule-merge-messagesElijah Newren via GitGitGadget, Aug 18, 2022
  14. 1/3 merge-ort: remove translator lego in new "submodule conflict suggestion"Elijah Newren via GitGitGadget, Aug 18, 2022
  15. 2/3 merge-ort: avoid surprise with new sub_flag variableElijah Newren via GitGitGadget, Aug 18, 2022
  16. 3/3 merge-ort: provide helpful submodule update message when possibleElijah Newren via GitGitGadget, Aug 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.