From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Comment diff_tree
Date: Mon, 11 Dec 2006 22:13:06 +0000 [thread overview]
Message-ID: <200612112213.06547.andyparkins@gmail.com> (raw)
In-Reply-To: <f323e83a37efd3b913004666f2fc104578a92833.1165875140.git.andyparkins@gmail.com>
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
tree-diff.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/tree-diff.c b/tree-diff.c
index 37d235e..009dd17 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -160,33 +160,44 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct tree
int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, struct diff_options *opt)
{
+ /* While there are entries left in t1 or t2... */
while (t1->size | t2->size) {
if (opt->nr_paths && t1->size && !interesting(t1, base, opt)) {
+ /* If there are paths left in t1, and the current path is
+ * not interesting, skip it and try the next path in t1 */
update_tree_entry(t1);
continue;
}
if (opt->nr_paths && t2->size && !interesting(t2, base, opt)) {
+ /* If there are paths left in t2, and the current path is
+ * not interesting, skip it and try the next path in t2 */
update_tree_entry(t2);
continue;
}
+ /* Here if either
+ * - Either t1 or t2 path is available and interesting
+ * - No paths available */
if (!t1->size) {
+ /* If there is no path left in t1, then t2 is a new path */
show_entry(opt, "+", t2, base);
update_tree_entry(t2);
continue;
}
if (!t2->size) {
+ /* If there is no path left in t2, then t1 is a remed path */
show_entry(opt, "-", t1, base);
update_tree_entry(t1);
continue;
}
+ /* If both paths are available and interesting then it is a change */
switch (compare_tree_entry(t1, t2, base, opt)) {
- case -1:
+ case -1: /* Finished with the path in t1 */
update_tree_entry(t1);
continue;
- case 0:
+ case 0: /* Finished with both paths */
update_tree_entry(t1);
/* Fallthrough */
- case 1:
+ case 1: /* Finished with the path in t2 */
update_tree_entry(t2);
continue;
}
--
1.4.4.1.geeee8
next prev parent reply other threads:[~2006-12-11 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <f323e83a37efd3b913004666f2fc104578a92833.1165875140.git.andyparkins@gmail.com>
2006-12-11 22:13 ` [PATCH] Comment -p mode for cat-file Andy Parkins
2006-12-11 22:13 ` Andy Parkins [this message]
2006-12-11 22:13 ` [PATCH] Add comments to update_tree_entry() Andy Parkins
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=200612112213.06547.andyparkins@gmail.com \
--to=andyparkins@gmail.com \
--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).