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

[PATCH 3/3] diff --submodule=diff: Don't print failure message twice

From
David Turner <dturner@twosigma.com>
Date
Jul 26, 2021, 18:33 UTC
Message-ID
<20210726183358.3255233-3-dturner@twosigma.com>
In-Reply-To
<20210726183358.3255233-1-dturner@twosigma.com>

When we fail to start a diff command inside a submodule, immediately exit the routine rather than trying to finish the command and printing a second message.

Signed-off-by: David Turner <dturner@twosigma.com>
---
 submodule.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/submodule.c b/submodule.c
index 9031527a16..0acfad3d4c 100644
--- a/submodule.c
+++ b/submodule.c
@@ -713,8 +713,10 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 		strvec_push(&cp.args, oid_to_hex(new_oid));
 
 	prepare_submodule_repo_env(&cp.env_array);
-	if (start_command(&cp))
+	if (start_command(&cp)) {
 		diff_emit_submodule_error(o, "(diff failed)\n");
+		goto done;
+	}
 
 	while (strbuf_getwholeline_fd(&sb, cp.out, '\n') != EOF)
 		diff_emit_submodule_pipethrough(o, sb.buf, sb.len);
-- 
2.11.GIT
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 12 in “Remove unused var”
  1. 1/3 Remove unused varDavid Turner, Jul 26, 2021
  2. 2/3 diff --submodule=diff: do not fail on ever-initialied deleted submodulesDavid Turner, Jul 26, 2021
  3. Junio C HamanoJul 26, 2021
  4. David TurnerJul 27, 2021
  5. Junio C HamanoAug 31, 2021
  6. 1/3 Remove unused varDavid Turner, Aug 31, 2021
  7. 2/3 diff --submodule=diff: do not fail on ever-initialied deleted submodulesDavid Turner, Aug 31, 2021
  8. 3/3 diff --submodule=diff: Don't print failure message twiceDavid Turner, Aug 31, 2021
  9. Junio C HamanoAug 31, 2021
  10. 3/3 diff --submodule=diff: Don't print failure message twiceDavid Turner, Jul 26, 2021
  11. Junio C HamanoJul 26, 2021
  12. Junio C HamanoJul 26, 2021

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.