]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jv/pack-objects-narrower-ref-iteration'
authorJunio C Hamano <gitster@pobox.com>
Sat, 6 Feb 2021 00:40:45 +0000 (16:40 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 6 Feb 2021 00:40:45 +0000 (16:40 -0800)
The "pack-objects" command needs to iterate over all the tags when
automatic tag following is enabled, but it actually iterated over
all refs and then discarded everything outside "refs/tags/"
hierarchy, which was quite wasteful.

* jv/pack-objects-narrower-ref-iteration:
  builtin/pack-objects.c: avoid iterating all refs

1  2 
builtin/pack-objects.c

index 57f0bc28b88ecb365e262e476e1e61f1a0f4e625,ad52c91bdbf3c78a639174a9d6528fc4819035a2..13cde5896aac80ab43408b1e89916832b1e8ec9c
@@@ -2818,9 -2807,7 +2818,7 @@@ static int add_ref_tag(const char *tag
  {
        struct object_id peeled;
  
-       if (starts_with(path, "refs/tags/") && /* is a tag? */
-           !peel_iterated_oid(oid, &peeled)    && /* peelable? */
-           obj_is_packed(&peeled)) /* object packed? */
 -      if (!peel_ref(tag, &peeled) && obj_is_packed(&peeled))
++      if (!peel_iterated_oid(oid, &peeled) && obj_is_packed(&peeled))
                add_tag_chain(oid);
        return 0;
  }