git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [RFC PATCH v2 0/4] for-each-ref: delay parsing of --sort=<atom> options + linux-leaks fixes
Date: Wed, 20 Oct 2021 15:24:32 +0200	[thread overview]
Message-ID: <RFC-cover-v2-0.4-00000000000-20211020T131627Z-avarab@gmail.com> (raw)
In-Reply-To: <211020.864k9boo0f.gmgdl@evledraar.gmail.com>

As noted in <211020.864k9boo0f.gmgdl@evledraar.gmail.com> the upthread
patch breaks the linux-leaks job, since simple invocations of "git
tag" start leaking memory: https://github.com/git/git/runs/3934925278

I tried to structure this as somethnig that could be merged or queued
up separately, but the semantic conflict in "branch.c" was difficult,
as Junio's patch changes how those variables are managed.

Junio C Hamano (1):
  for-each-ref: delay parsing of --sort=<atom> options

Ævar Arnfjörð Bjarmason (3):
  tag: use a "goto cleanup" pattern, leak less memory
  ref-filter API user: add and use a ref_sorting_release()
  branch: use ref_sorting_release()

 builtin/branch.c        | 24 ++++++++++++-----------
 builtin/for-each-ref.c  | 10 +++++-----
 builtin/ls-remote.c     | 13 ++++++++-----
 builtin/tag.c           | 42 ++++++++++++++++++++++-------------------
 ref-filter.c            | 40 ++++++++++++++++++++++++++++++---------
 ref-filter.h            | 30 ++++++++++++-----------------
 t/t3200-branch.sh       | 12 +++++++++++-
 t/t6300-for-each-ref.sh |  5 +++++
 8 files changed, 108 insertions(+), 68 deletions(-)

Range-diff against v1:
-:  ----------- > 1:  fc776c3f1cd tag: use a "goto cleanup" pattern, leak less memory
-:  ----------- > 2:  0ae71c19ab7 ref-filter API user: add and use a ref_sorting_release()
1:  21a1f4d3b08 ! 3:  7abbbe4468c for-each-ref: delay parsing of --sort=<atom> options
    @@ builtin/ls-remote.c: int cmd_ls_remote(int argc, const char **argv, const char *
     -	if (sorting)
     +	if (sorting_options.nr) {
     +		struct ref_sorting *sorting;
    -+		UNLEAK(sorting);
     +
     +		sorting = ref_sorting_options(&sorting_options);
      		ref_array_sort(sorting, &ref_array);
    ++		ref_sorting_release(sorting);
     +	}
      
      	for (i = 0; i < ref_array.nr; i++) {
    @@ ref-filter.c: void parse_ref_sorting(struct ref_sorting **sorting_tail, const ch
     +	return sorting;
      }
      
    - int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
    + void ref_sorting_release(struct ref_sorting *sorting)
     
      ## ref-filter.h ##
     @@
    @@ ref-filter.h: int format_ref_array_item(struct ref_array_item *info,
     -struct ref_sorting *ref_default_sorting(void);
     +/*  Convert list of sort options into ref_sorting */
     +struct ref_sorting *ref_sorting_options(struct string_list *);
    + /* Release a "struct ref_sorting" */
    + void ref_sorting_release(struct ref_sorting *);
      /*  Function to parse --merged and --no-merged options */
    - int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset);
    - /*  Get the current HEAD's description */
     
      ## t/t3200-branch.sh ##
     @@ t/t3200-branch.sh: test_expect_success 'invalid sort parameter in configuration' '
-:  ----------- > 4:  f7d87aea384 branch: use ref_sorting_release()
-- 
2.33.1.1338.g20da966911a


  reply	other threads:[~2021-10-20 13:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 18:32 [PATCH] for-each-ref: delay parsing of --sort=<atom> options Junio C Hamano
2021-10-19 22:18 ` Jeff King
2021-10-20  2:20   ` Jeff King
2021-10-20 12:30     ` Ævar Arnfjörð Bjarmason
2021-10-20 13:24       ` Ævar Arnfjörð Bjarmason [this message]
2021-10-20 13:24         ` [RFC PATCH v2 1/4] tag: use a "goto cleanup" pattern, leak less memory Ævar Arnfjörð Bjarmason
2021-10-20 14:37           ` Junio C Hamano
2021-10-20 13:24         ` [RFC PATCH v2 2/4] ref-filter API user: add and use a ref_sorting_release() Ævar Arnfjörð Bjarmason
2021-10-20 14:39           ` Junio C Hamano
2021-10-20 13:24         ` [RFC PATCH v2 3/4] for-each-ref: delay parsing of --sort=<atom> options Ævar Arnfjörð Bjarmason
2021-10-20 13:24         ` [RFC PATCH v2 4/4] branch: use ref_sorting_release() Ævar Arnfjörð Bjarmason
2021-10-20 14:43         ` [RFC PATCH v2 0/4] for-each-ref: delay parsing of --sort=<atom> options + linux-leaks fixes Junio C Hamano
2021-10-20 18:27         ` [PATCH 0/3] ref-filter: add a ref_sorting_release() Ævar Arnfjörð Bjarmason
2021-10-20 18:27           ` [PATCH 1/3] tag: use a "goto cleanup" pattern, leak less memory Ævar Arnfjörð Bjarmason
2021-10-20 18:27           ` [PATCH 2/3] ref-filter API user: add and use a ref_sorting_release() Ævar Arnfjörð Bjarmason
2021-10-20 18:27           ` [PATCH 3/3] branch: use ref_sorting_release() Ævar Arnfjörð Bjarmason
2021-10-20 13:58   ` [PATCH] for-each-ref: delay parsing of --sort=<atom> options Junio C Hamano
2021-10-20 20:48     ` Jeff King
2021-10-20 21:32       ` Junio C Hamano
2021-10-21 14:54         ` 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=RFC-cover-v2-0.4-00000000000-20211020T131627Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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).