From: Jacob Vosmaer <jacob@gitlab.com>
To: git@vger.kernel.org
Cc: Jacob Vosmaer <jacob@gitlab.com>
Subject: [PATCH 1/1] builtin/pack-objects.c: avoid iterating all refs
Date: Tue, 19 Jan 2021 15:33:48 +0100 [thread overview]
Message-ID: <20210119143348.27535-2-jacob@gitlab.com> (raw)
In-Reply-To: <20210119143348.27535-1-jacob@gitlab.com>
In git-pack-objects, we iterate over all the tags if the --include-tag
option is passed on the command line. For some reason this uses
for_each_ref which is expensive if the repo has many refs. We should
use a prefix iterator instead.
Signed-off-by: Jacob Vosmaer <jacob@gitlab.com>
---
builtin/pack-objects.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 2a00358f34..2b32bc93bd 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -3740,7 +3740,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
}
cleanup_preferred_base();
if (include_tag && nr_result)
- for_each_ref(add_ref_tag, NULL);
+ for_each_fullref_in("refs/tags/", add_ref_tag, NULL, 0);
stop_progress(&progress_state);
trace2_region_leave("pack-objects", "enumerate-objects",
the_repository);
--
2.30.0
next prev parent reply other threads:[~2021-01-19 22:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-19 14:33 [PATCH 0/1] builtin/pack-objects.c: avoid iterating all refs Jacob Vosmaer
2021-01-19 14:33 ` Jacob Vosmaer [this message]
2021-01-19 23:08 ` [PATCH 1/1] " Taylor Blau
2021-01-19 23:33 ` Jeff King
2021-01-19 23:54 ` Taylor Blau
2021-01-19 23:15 ` Jeff King
2021-01-20 8:50 ` Ævar Arnfjörð Bjarmason
2021-01-20 15:02 ` Taylor Blau
2021-01-20 16:32 ` Ævar Arnfjörð Bjarmason
2021-01-20 19:53 ` Jeff King
2021-01-21 10:26 ` Ævar Arnfjörð Bjarmason
2021-01-21 15:34 ` Jeff King
2021-01-19 23:26 ` [PATCH 0/1] " Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210119143348.27535-2-jacob@gitlab.com \
--to=jacob@gitlab.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).