]> git.ipfire.org Git - thirdparty/git.git/commitdiff
rev-list: add an option to mark fewer edges as uninteresting
authorbrian m. carlson <sandals@crustytoothpaste.net>
Wed, 24 Dec 2014 23:05:39 +0000 (23:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Dec 2014 17:57:55 +0000 (09:57 -0800)
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>
Documentation/git-rev-list.txt
Documentation/rev-list-options.txt
builtin/pack-objects.c
list-objects.c
revision.c
revision.h

index fd7f8b5bc1840bc93273dd7b076d86499626912a..5b119220bf168153d63bf2051a065e40b68c1ed3 100644 (file)
@@ -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 ]
index 2277fcbb892f3233ef4a8c288e902f3f7776b70d..8cb6f92e19a3ee228f108e19e4e61f9c8ebe051d 100644 (file)
@@ -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.
index 3f9f5c7760a63bc2deb32b75f500ac0d1bc87538..f93a17c4655197d443dfcb71a3f86bbeb22c558c 100644 (file)
@@ -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");
 
index 2910becd6c65b66670215aefdf08e1933895aa39..2a139b6ced68809f3a324f493325ec62c3a44044 100644 (file)
@@ -157,7 +157,7 @@ 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);
                        }
@@ -165,7 +165,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
                }
                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;
index 75dda928ea6be1dacd2fbeba5c0ce207ea46dd25..753dd2fca2ecd2e25904a0381614181479d14b5c 100644 (file)
@@ -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;
index 9cb5adc4ea25bfdc37ced8b8a98b1fd58661c9e9..033a24460e71b723f95ef91f4b6f0dbfd8c2c390 100644 (file)
@@ -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,