summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2022-11-29 13:23:53 +0100
committerJunio C Hamano <gitster@pobox.com>2022-11-30 10:00:33 +0900
commit825babe5d5c720cb196f4f12c8eeb15fe00e95a1 (patch)
treee22d6958c4d81df1ec86534b1e944743488fc1ce /builtin/pack-objects.c
parentf00d81153336e1d560288c5f698aada3ca507dba (diff)
downloadgit-825babe5d5c720cb196f4f12c8eeb15fe00e95a1.tar.gz
pack-objects: fix handling of multiple --filter options
Since 5cb28270a1 (pack-objects: lazily set up "struct rev_info", don't leak, 2022-03-28) --filter options given to git pack-objects overrule earlier ones, letting only the leftmost win and leaking the memory allocated for earlier ones. Fix that by only initializing the rev_info struct once. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 573d0b20b7..c702c09dd4 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -4158,7 +4158,8 @@ static struct list_objects_filter_options *po_filter_revs_init(void *value)
{
struct po_filter_data *data = value;
- repo_init_revisions(the_repository, &data->revs, NULL);
+ if (!data->have_revs)
+ repo_init_revisions(the_repository, &data->revs, NULL);
data->have_revs = 1;
return &data->revs.filter;