aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-10 21:59:37 -0800
committerJunio C Hamano <junkio@cox.net>2006-03-10 21:59:37 -0800
commitf3219fbbba32b5100430c17468524b776eb869d6 (patch)
tree29ba412145685976910f966320bb19a93c198046 /revision.c
parenteb0e0024b746a8ab6596928c792e002217ef334b (diff)
downloadgit-f3219fbbba32b5100430c17468524b776eb869d6.tar.gz
git-f3219fbbba32b5100430c17468524b776eb869d6.tar.xz
try_to_simplify_commit(): do not skip inspecting tree change at boundary.
When git-rev-list (and git-log) collapsed ancestry chain to commits that touch specified paths, we failed to inspect and notice tree changes when we are about to hit uninteresting parent. This resulted in "git rev-list since.. -- file" to always show the child commit after the lower bound, even if it does not touch the file. This commit fixes it. Thanks for Catalin for reporting this. See also: 461cf59f8924f174d7a0dcc3d77f576d93ed29a4 Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/revision.c b/revision.c
index 713f27e3c..c8d93ff10 100644
--- a/revision.c
+++ b/revision.c
@@ -282,6 +282,7 @@ static int same_tree_as_empty(struct tree *t1)
static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
{
struct commit_list **pp, *parent;
+ int tree_changed = 0;
if (!commit->tree)
return;
@@ -296,14 +297,19 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
while ((parent = *pp) != NULL) {
struct commit *p = parent->item;
- if (p->object.flags & UNINTERESTING) {
- pp = &parent->next;
- continue;
- }
-
parse_commit(p);
switch (compare_tree(p->tree, commit->tree)) {
case TREE_SAME:
+ if (p->object.flags & UNINTERESTING) {
+ /* Even if a merge with an uninteresting
+ * side branch brought the entire change
+ * we are interested in, we do not want
+ * to lose the other branches of this
+ * merge, so we just keep going.
+ */
+ pp = &parent->next;
+ continue;
+ }
parent->next = NULL;
commit->parents = parent;
return;
@@ -315,12 +321,14 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
}
/* fallthrough */
case TREE_DIFFERENT:
+ tree_changed = 1;
pp = &parent->next;
continue;
}
die("bad tree compare for commit %s", sha1_to_hex(commit->object.sha1));
}
- commit->object.flags |= TREECHANGE;
+ if (tree_changed)
+ commit->object.flags |= TREECHANGE;
}
static void add_parents_to_list(struct rev_info *revs, struct commit *commit, struct commit_list **list)