[PATCH] submodule: show_submodule_summary: preserve diff queue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]