diff --submodule=diff: don't print failure message twice

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Turner committed Aug 31, 2021 at 09:12 UTC 67f61efbb92dce64b33c3280b89e9f253a34df1c
1 file changed +3 -1
submodule.c
+3 -1
@@ -720,8 +720,10 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
720 strvec_push(&cp.env_array, GIT_WORK_TREE_ENVIRONMENT "=.");
721 }
722
723 - if (start_command(&cp))
723 + if (start_command(&cp)) {
724 diff_emit_submodule_error(o, "(diff failed)\n");
725 + goto done;
726 + }
727
728 while (strbuf_getwholeline_fd(&sb, cp.out, '\n') != EOF)
729 diff_emit_submodule_pipethrough(o, sb.buf, sb.len);