Skip to content

Commit 1684c1b

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8297643 commit 1684c1b

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

Documentation/git-rev-list.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ SYNOPSIS
4646
[ \--extended-regexp | -E ]
4747
[ \--fixed-strings | -F ]
4848
[ \--date=(local|relative|default|iso|iso-strict|rfc|short) ]
49-
[ [\--objects | \--objects-edge] [ \--unpacked ] ]
49+
[ [ \--objects | \--objects-edge | \--objects-edge-aggressive ]
50+
[ \--unpacked ] ]
5051
[ \--pretty | \--header ]
5152
[ \--bisect ]
5253
[ \--bisect-vars ]

Documentation/rev-list-options.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,10 @@ These options are mostly targeted for packing of Git repositories.
657657
objects in deltified form based on objects contained in these
658658
excluded commits to reduce network traffic.
659659

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+
660664
--unpacked::
661665
Only useful with `--objects`; print the object IDs that are not
662666
in packs.

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2711,7 +2711,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
27112711
argv_array_push(&rp, "pack-objects");
27122712
if (thin) {
27132713
use_internal_rev_list = 1;
2714-
argv_array_push(&rp, "--objects-edge");
2714+
argv_array_push(&rp, "--objects-edge-aggressive");
27152715
} else
27162716
argv_array_push(&rp, "--objects");
27172717

list-objects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
157157

158158
if (commit->object.flags & UNINTERESTING) {
159159
mark_tree_uninteresting(commit->tree);
160-
if (revs->edge_hint && !(commit->object.flags & SHOWN)) {
160+
if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
161161
commit->object.flags |= SHOWN;
162162
show_edge(commit);
163163
}
164164
continue;
165165
}
166166
mark_edge_parents_uninteresting(commit, revs, show_edge);
167167
}
168-
if (revs->edge_hint) {
168+
if (revs->edge_hint_aggressive) {
169169
for (i = 0; i < revs->cmdline.nr; i++) {
170170
struct object *obj = revs->cmdline.rev[i].item;
171171
struct commit *commit = (struct commit *)obj;

revision.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
18531853
revs->tree_objects = 1;
18541854
revs->blob_objects = 1;
18551855
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;
18561862
} else if (!strcmp(arg, "--verify-objects")) {
18571863
revs->tag_objects = 1;
18581864
revs->tree_objects = 1;

revision.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ struct rev_info {
9393
blob_objects:1,
9494
verify_objects:1,
9595
edge_hint:1,
96+
edge_hint_aggressive:1,
9697
limited:1,
9798
unpacked:1,
9899
boundary:2,

0 commit comments

Comments
 (0)