git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zoltán Füzesi" <zfuzesi@eaglet.hu>
To: git@vger.kernel.org
Cc: "Zoltán Füzesi" <zfuzesi@eaglet.hu>
Subject: [PATCH] submodule: show_submodule_summary: preserve diff queue
Date: Wed,  4 Aug 2010 16:45:06 +0200	[thread overview]
Message-ID: <1280933106-7016-1-git-send-email-zfuzesi@eaglet.hu> (raw)

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

             reply	other threads:[~2010-08-04 14:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04 14:45 Zoltán Füzesi [this message]
2010-08-04 18:15 ` [PATCH] submodule: show_submodule_summary: preserve diff queue Füzesi Zoltán

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280933106-7016-1-git-send-email-zfuzesi@eaglet.hu \
    --to=zfuzesi@eaglet.hu \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).