Skip to content

Commit

Permalink
rev-list: add an option to mark fewer edges as uninteresting
Browse files Browse the repository at this point in the history
In commit fbd4a70 (list-objects: mark more commits as edges in
mark_edges_uninteresting - 2013-08-16), we marked an increasing number
of edges uninteresting.  This change, and the subsequent change to make
this conditional on --objects-edge, are used by --thin to make much
smaller packs for shallow clones.

Unfortunately, they cause a significant performance regression when
pushing non-shallow clones with lots of refs (23.322 seconds vs.
4.785 seconds with 22400 refs).  Add an option to git rev-list,
--objects-edge-aggressive, that preserves this more aggressive behavior,
while leaving --objects-edge to provide more performant behavior.
Preserve the current behavior for the moment by using the aggressive
option.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
brian m. carlson authored and Junio C Hamano committed Dec 29, 2014
1 parent 8297643 commit 1684c1b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Documentation/git-rev-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ SYNOPSIS
[ \--extended-regexp | -E ]
[ \--fixed-strings | -F ]
[ \--date=(local|relative|default|iso|iso-strict|rfc|short) ]
[ [\--objects | \--objects-edge] [ \--unpacked ] ]
[ [ \--objects | \--objects-edge | \--objects-edge-aggressive ]
[ \--unpacked ] ]
[ \--pretty | \--header ]
[ \--bisect ]
[ \--bisect-vars ]
Expand Down
4 changes: 4 additions & 0 deletions Documentation/rev-list-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ These options are mostly targeted for packing of Git repositories.
objects in deltified form based on objects contained in these
excluded commits to reduce network traffic.

--objects-edge-aggressive::
Similar to `--objects-edge`, but it tries harder to find excluded
commits at the cost of increased time.

--unpacked::
Only useful with `--objects`; print the object IDs that are not
in packs.
Expand Down
2 changes: 1 addition & 1 deletion builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -2711,7 +2711,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
argv_array_push(&rp, "pack-objects");
if (thin) {
use_internal_rev_list = 1;
argv_array_push(&rp, "--objects-edge");
argv_array_push(&rp, "--objects-edge-aggressive");
} else
argv_array_push(&rp, "--objects");

Expand Down
4 changes: 2 additions & 2 deletions list-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)

if (commit->object.flags & UNINTERESTING) {
mark_tree_uninteresting(commit->tree);
if (revs->edge_hint && !(commit->object.flags & SHOWN)) {
if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
commit->object.flags |= SHOWN;
show_edge(commit);
}
continue;
}
mark_edge_parents_uninteresting(commit, revs, show_edge);
}
if (revs->edge_hint) {
if (revs->edge_hint_aggressive) {
for (i = 0; i < revs->cmdline.nr; i++) {
struct object *obj = revs->cmdline.rev[i].item;
struct commit *commit = (struct commit *)obj;
Expand Down
6 changes: 6 additions & 0 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->tree_objects = 1;
revs->blob_objects = 1;
revs->edge_hint = 1;
} else if (!strcmp(arg, "--objects-edge-aggressive")) {
revs->tag_objects = 1;
revs->tree_objects = 1;
revs->blob_objects = 1;
revs->edge_hint = 1;
revs->edge_hint_aggressive = 1;
} else if (!strcmp(arg, "--verify-objects")) {
revs->tag_objects = 1;
revs->tree_objects = 1;
Expand Down
1 change: 1 addition & 0 deletions revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct rev_info {
blob_objects:1,
verify_objects:1,
edge_hint:1,
edge_hint_aggressive:1,
limited:1,
unpacked:1,
boundary:2,
Expand Down

0 comments on commit 1684c1b

Please sign in to comment.