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

[PATCH] submodule: show_submodule_summary: preserve diff queue

From
ZFZoltán Füzesi <zfuzesi@eaglet.hu>
Date
Aug 4, 2010, 14:45 UTC
Message-ID
<1280933106-7016-1-git-send-email-zfuzesi@eaglet.hu>
git-diff with --submodule option stopped printing diff lines after a submodule
change, because show_submodule_summary reset diff queue.
---
 submodule.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/submodule.c b/submodule.c
index 61cb6e2..5b57536 100644
--- a/submodule.c
+++ b/submodule.c
@@ -46,6 +46,12 @@ done:
 	return ret;
 }
 
+static void diff_q_copy(struct diff_queue_struct *dst,
+			struct diff_queue_struct *src)
+{
+	memcpy(dst, src, sizeof(struct diff_queue_struct));
+}
+
 void handle_ignore_submodules_arg(struct diff_options *diffopt,
 				  const char *arg)
 {
@@ -71,6 +77,7 @@ void show_submodule_summary(FILE *f, const char *path,
 	struct strbuf sb = STRBUF_INIT;
 	static const char *format = "  %m %s";
 	int fast_forward = 0, fast_backward = 0;
+	struct diff_queue_struct diff_q_backup;
 
 	if (is_null_sha1(two))
 		message = "(submodule deleted)";
@@ -83,6 +90,7 @@ void show_submodule_summary(FILE *f, const char *path,
 		message = "(commits not present)";
 
 	if (!message) {
+		diff_q_copy(&diff_q_backup, &diff_queued_diff);
 		init_revisions(&rev, NULL);
 		setup_revisions(0, NULL, &rev, NULL);
 		rev.left_right = 1;
@@ -146,6 +154,7 @@ void show_submodule_summary(FILE *f, const char *path,
 		}
 		clear_commit_marks(left, ~0);
 		clear_commit_marks(right, ~0);
+		diff_q_copy(&diff_queued_diff, &diff_q_backup);
 	}
 	strbuf_release(&sb);
 }
-- 
1.7.2.1.22.ge7bdd
Next: Füzesi Zoltán
Message 1 of 2 in “submodule: show_submodule_summary: preserve diff queue”
  1. submodule: show_submodule_summary: preserve diff queueZoltán Füzesi, Aug 4, 2010
  2. Füzesi ZoltánAug 4, 2010

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.