diff options
author | Patrick Steinhardt <ps@pks.im> | 2023-04-14 09:01:54 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-04-14 20:27:51 +0300 |
commit | 752b465c3c0fd7f503b50c326017b8b13af83c3b (patch) | |
tree | c4147890cb3bef22549dfdca55271c6857189b54 /builtin/pack-objects.c | |
parent | 732194b5f2ff50fc536b28c3d5a3e43e0110419b (diff) |
pack-objects: fix error when same packfile is included and excluded
When passing the same packfile both as included and excluded via the
`--stdin-packs` option, then we will return an error because the
excluded packfile cannot be found. This is because we will only set the
`util` pointer for the included packfile list if it was found, so that
we later die when we notice that it's in fact not set for the excluded
packfile list.
Fix this bug by always setting the `util` pointer for both the included
and excluded list entries.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r-- | builtin/pack-objects.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c97ae1b6d0..884b84a2fd 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -3351,11 +3351,9 @@ static void read_packs_list_from_stdin(void) for (p = get_all_packs(the_repository); p; p = p->next) { const char *pack_name = pack_basename(p); - item = string_list_lookup(&include_packs, pack_name); - if (!item) - item = string_list_lookup(&exclude_packs, pack_name); - - if (item) + if ((item = string_list_lookup(&include_packs, pack_name))) + item->util = p; + if ((item = string_list_lookup(&exclude_packs, pack_name))) item->util = p; } |