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:
461cf59f89
Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
parent
eb0e0024b7
commit
f3219fbbba
18
revision.c
18
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)
|
static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||||
{
|
{
|
||||||
struct commit_list **pp, *parent;
|
struct commit_list **pp, *parent;
|
||||||
|
int tree_changed = 0;
|
||||||
|
|
||||||
if (!commit->tree)
|
if (!commit->tree)
|
||||||
return;
|
return;
|
||||||
|
@ -296,14 +297,19 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||||
while ((parent = *pp) != NULL) {
|
while ((parent = *pp) != NULL) {
|
||||||
struct commit *p = parent->item;
|
struct commit *p = parent->item;
|
||||||
|
|
||||||
if (p->object.flags & UNINTERESTING) {
|
|
||||||
pp = &parent->next;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
parse_commit(p);
|
parse_commit(p);
|
||||||
switch (compare_tree(p->tree, commit->tree)) {
|
switch (compare_tree(p->tree, commit->tree)) {
|
||||||
case TREE_SAME:
|
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;
|
parent->next = NULL;
|
||||||
commit->parents = parent;
|
commit->parents = parent;
|
||||||
return;
|
return;
|
||||||
|
@ -315,11 +321,13 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||||
}
|
}
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case TREE_DIFFERENT:
|
case TREE_DIFFERENT:
|
||||||
|
tree_changed = 1;
|
||||||
pp = &parent->next;
|
pp = &parent->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
die("bad tree compare for commit %s", sha1_to_hex(commit->object.sha1));
|
die("bad tree compare for commit %s", sha1_to_hex(commit->object.sha1));
|
||||||
}
|
}
|
||||||
|
if (tree_changed)
|
||||||
commit->object.flags |= TREECHANGE;
|
commit->object.flags |= TREECHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue