rev-list: add an option to mark fewer edges as uninteresting

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>

brian m. carlson committed Dec 24, 2014 at 23:05 UTC 1684c1b219e02c91655ad929f752f4f864c72faf
6 files changed +16 -4
Documentation/git-rev-list.txt
+2 -1
@@ -46,7 +46,8 @@ SYNOPSIS
46 [ \--extended-regexp | -E ]
47 [ \--fixed-strings | -F ]
48 [ \--date=(local|relative|default|iso|iso-strict|rfc|short) ]
49 - [ [\--objects | \--objects-edge] [ \--unpacked ] ]
49 + [ [ \--objects | \--objects-edge | \--objects-edge-aggressive ]
50 + [ \--unpacked ] ]
51 [ \--pretty | \--header ]
52 [ \--bisect ]
53 [ \--bisect-vars ]
Documentation/rev-list-options.txt
+4
@@ -657,6 +657,10 @@ These options are mostly targeted for packing of Git repositories.
657 objects in deltified form based on objects contained in these
658 excluded commits to reduce network traffic.
659
660 +--objects-edge-aggressive::
661 + Similar to `--objects-edge`, but it tries harder to find excluded
662 + commits at the cost of increased time.
663 +
664 --unpacked::
665 Only useful with `--objects`; print the object IDs that are not
666 in packs.
builtin/pack-objects.c
+1 -1
@@ -2711,7 +2711,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2711 argv_array_push(&rp, "pack-objects");
2712 if (thin) {
2713 use_internal_rev_list = 1;
2714 - argv_array_push(&rp, "--objects-edge");
2714 + argv_array_push(&rp, "--objects-edge-aggressive");
2715 } else
2716 argv_array_push(&rp, "--objects");
2717
list-objects.c
+2 -2
@@ -157,7 +157,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
157
158 if (commit->object.flags & UNINTERESTING) {
159 mark_tree_uninteresting(commit->tree);
160 - if (revs->edge_hint && !(commit->object.flags & SHOWN)) {
160 + if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
161 commit->object.flags |= SHOWN;
162 show_edge(commit);
163 }
@@ -165,7 +165,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
165 }
166 mark_edge_parents_uninteresting(commit, revs, show_edge);
167 }
168 - if (revs->edge_hint) {
168 + if (revs->edge_hint_aggressive) {
169 for (i = 0; i < revs->cmdline.nr; i++) {
170 struct object *obj = revs->cmdline.rev[i].item;
171 struct commit *commit = (struct commit *)obj;
revision.c
+6
@@ -1853,6 +1853,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
1853 revs->tree_objects = 1;
1854 revs->blob_objects = 1;
1855 revs->edge_hint = 1;
1856 + } else if (!strcmp(arg, "--objects-edge-aggressive")) {
1857 + revs->tag_objects = 1;
1858 + revs->tree_objects = 1;
1859 + revs->blob_objects = 1;
1860 + revs->edge_hint = 1;
1861 + revs->edge_hint_aggressive = 1;
1862 } else if (!strcmp(arg, "--verify-objects")) {
1863 revs->tag_objects = 1;
1864 revs->tree_objects = 1;
revision.h
+1
@@ -93,6 +93,7 @@ struct rev_info {
93 blob_objects:1,
94 verify_objects:1,
95 edge_hint:1,
96 + edge_hint_aggressive:1,
97 limited:1,
98 unpacked:1,
99 boundary:2,