git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] submodule: show_submodule_summary: preserve diff queue
@ 2010-08-04 14:45 Zoltán Füzesi
  2010-08-04 18:15 ` Füzesi Zoltán
  0 siblings, 1 reply; 2+ messages in thread
From: Zoltán Füzesi @ 2010-08-04 14:45 UTC (permalink / raw)
  To: git; +Cc: Zoltán Füzesi

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-04 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-04 14:45 [PATCH] submodule: show_submodule_summary: preserve diff queue Zoltán Füzesi
2010-08-04 18:15 ` Füzesi Zoltán

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 NNTP newsgroup(s).