1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-19 23:26:13 +02:00

Merge branch 'jk/mark-edges-uninteresting'

Fix performance regression in v1.8.4.x and later.

* jk/mark-edges-uninteresting:
  list-objects: only look at cmdline trees with edge_hint
  t/perf: time rev-list with UNINTERESTING commits
This commit is contained in:
Junio C Hamano 2014-01-27 10:45:08 -08:00
commit a6bec00145
2 changed files with 23 additions and 9 deletions

View File

@ -162,15 +162,17 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
}
mark_edge_parents_uninteresting(commit, revs, show_edge);
}
for (i = 0; i < revs->cmdline.nr; i++) {
struct object *obj = revs->cmdline.rev[i].item;
struct commit *commit = (struct commit *)obj;
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
continue;
mark_tree_uninteresting(commit->tree);
if (revs->edge_hint && !(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
show_edge(commit);
if (revs->edge_hint) {
for (i = 0; i < revs->cmdline.nr; i++) {
struct object *obj = revs->cmdline.rev[i].item;
struct commit *commit = (struct commit *)obj;
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
continue;
mark_tree_uninteresting(commit->tree);
if (!(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
show_edge(commit);
}
}
}
}

View File

@ -14,4 +14,16 @@ test_perf 'rev-list --all --objects' '
git rev-list --all --objects >/dev/null
'
test_expect_success 'create new unreferenced commit' '
commit=$(git commit-tree HEAD^{tree} -p HEAD)
'
test_perf 'rev-list $commit --not --all' '
git rev-list $commit --not --all >/dev/null
'
test_perf 'rev-list --objects $commit --not --all' '
git rev-list --objects $commit --not --all >/dev/null
'
test_done