fast-export: factor out anonymized_entry creation
commitdcc4e134aa7e469ef56a988696229e7b9a686f96
authorJeff King <peff@peff.net>
Wed, 22 Mar 2023 17:40:51 +0000 (22 13:40 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Mar 2023 22:37:09 +0000 (22 15:37 -0700)
tree63ec3ef236fb9c3b28aecfa88b4687345ecbeba8
parentd6484e9fab5747dd1d36fd7895e796922f4e2c76
fast-export: factor out anonymized_entry creation

When anonymizing output, there's only one spot where we generate new
entries to add to our hashmap: when anonymize_str() doesn't find an
entry, we use the generate() callback to make one and add it. Let's pull
that into its own function in preparation for another caller.

Note that we'll add one extra feature. In anonymize_str(), we know that
we won't find an existing entry in the hashmap (since it will only try
to add after failing to find one). But other callers won't have the same
behavior, so we should catch this case and free the now-dangling entry.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-export.c