From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Martin Ågren" <martin.agren@gmail.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH 1/2] diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec)
Date: Wed, 16 Feb 2022 13:48:55 -0800 [thread overview]
Message-ID: <xmqqh78ycwjc.fsf@gitster.g> (raw)
In-Reply-To: <patch-1.2-1c6c7f0f52f-20220216T105250Z-avarab@gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Wed, 16 Feb 2022 11:56:28 +0100")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> diff --git a/diff.c b/diff.c
> index c862771a589..0aef3db6e10 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -6345,6 +6345,7 @@ void diff_free(struct diff_options *options)
>
> diff_free_file(options);
> diff_free_ignore_regex(options);
> + clear_pathspec(&options->pathspec);
> }
>
> void diff_flush(struct diff_options *options)
Interesting. As diff_flush() is the way to conclude the diff
session whose state was kept in the diff_options structure, it
probably makes sense to allow pathspec to be also cleared from
there. It is somewhat surprising that we didn't do this when we
introduced diff_free(), but better late than never ;-)
> diff --git a/notes-merge.c b/notes-merge.c
> index b4a3a903e86..7ba40cfb080 100644
> --- a/notes-merge.c
> +++ b/notes-merge.c
> @@ -175,7 +175,6 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
> oid_to_hex(&mp->remote));
> }
> diff_flush(&opt);
> - clear_pathspec(&opt.pathspec);
>
> *num_changes = len;
> return changes;
> @@ -261,7 +260,6 @@ static void diff_tree_local(struct notes_merge_options *o,
> oid_to_hex(&mp->local));
> }
> diff_flush(&opt);
> - clear_pathspec(&opt.pathspec);
> }
>
> static void check_notes_merge_worktree(struct notes_merge_options *o)
Looks quite sensible. Will queue. Thanks.
next prev parent reply other threads:[~2022-02-16 21:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 10:56 [PATCH 0/2] diff_free(): free a bit more, fix leaks Ævar Arnfjörð Bjarmason
2022-02-16 10:56 ` [PATCH 1/2] diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec) Ævar Arnfjörð Bjarmason
2022-02-16 16:50 ` Elijah Newren
2022-02-17 10:22 ` Ævar Arnfjörð Bjarmason
2022-02-16 21:48 ` Junio C Hamano [this message]
2022-02-16 10:56 ` [PATCH 2/2] diff.[ch]: have diff_free() free options->parseopts Ævar Arnfjörð Bjarmason
2022-02-16 16:51 ` Elijah Newren
2022-02-16 16:52 ` [PATCH 0/2] diff_free(): free a bit more, fix leaks Elijah Newren
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=xmqqh78ycwjc.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=martin.agren@gmail.com \
--cc=pclouds@gmail.com \
/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).