From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Jens Lehmann" <Jens.Lehmann@web.de>
Subject: [PATCH 3/3] submodule: use diff_tree_combined_merge() instead of diff_tree_combined()
Date: Sat, 17 Dec 2011 11:27:19 +0100 [thread overview]
Message-ID: <4EEC6E87.3060204@lsrfire.ath.cx> (raw)
In-Reply-To: <4EEC6CD7.2030408@lsrfire.ath.cx>
Use diff_tree_combined_merge() instead of open-coding it.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
submodule.c | 14 +++-----------
1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/submodule.c b/submodule.c
index 788d532..9a28060 100644
--- a/submodule.c
+++ b/submodule.c
@@ -371,23 +371,15 @@ static void collect_submodules_from_diff(struct diff_queue_struct *q,
}
-static void commit_need_pushing(struct commit *commit, struct commit_list *parent, int *needs_pushing)
+static void commit_need_pushing(struct commit *commit, int *needs_pushing)
{
- struct sha1_array parents = SHA1_ARRAY_INIT;
struct rev_info rev;
- while (parent) {
- sha1_array_append(&parents, parent->item->object.sha1);
- parent = parent->next;
- }
-
init_revisions(&rev, NULL);
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = collect_submodules_from_diff;
rev.diffopt.format_callback_data = needs_pushing;
- diff_tree_combined(commit->object.sha1, &parents, 1, &rev);
-
- sha1_array_clear(&parents);
+ diff_tree_combined_merge(commit, 1, &rev);
}
int check_submodule_needs_pushing(unsigned char new_sha1[20], const char *remotes_name)
@@ -410,7 +402,7 @@ int check_submodule_needs_pushing(unsigned char new_sha1[20], const char *remote
die("revision walk setup failed");
while ((commit = get_revision(&rev)) && !needs_pushing)
- commit_need_pushing(commit, commit->parents, &needs_pushing);
+ commit_need_pushing(commit, &needs_pushing);
free(sha1_copy);
strbuf_release(&remotes_arg);
--
1.7.8
next prev parent reply other threads:[~2011-12-17 10:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-17 10:15 [PATCH 1/3] use struct sha1_array in diff_tree_combined() René Scharfe
2011-12-17 10:20 ` [PATCH 2/3] pass struct commit to diff_tree_combined_merge() René Scharfe
2011-12-17 10:27 ` René Scharfe [this message]
2011-12-17 10:27 ` René Scharfe
2011-12-17 10:27 ` [PATCH 1/3] use struct sha1_array in diff_tree_combined() René Scharfe
2011-12-17 10:53 ` Jeff King
2011-12-17 11:16 ` René Scharfe
2011-12-17 11:19 ` Jeff King
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=4EEC6E87.3060204@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=Jens.Lehmann@web.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.