public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Lucas Seiki Oshiro <lucasseikioshiro@gmail•com>
To: git@vger•kernel.org
Cc: ps@pks•im, karthik.188@gmail•com, gitster@pobox•com,
	Lucas Seiki Oshiro <lucasseikioshiro@gmail•com>
Subject: [PATCH v3 0/2] repo: add --all to git-repo-info
Date: Sun, 26 Oct 2025 19:52:06 -0300	[thread overview]
Message-ID: <20251026225409.46647-1-lucasseikioshiro@gmail.com> (raw)
In-Reply-To: <20250915223618.13093-1-lucasseikioshiro@gmail.com>

Hi!

This is the third version of the patchset that adds a new flag --all
to git-repo-info for requesting the values of all the available flags.

Now, in this version, git-repo-info will abort if it is called with --all
and some key.

Here's the range-diff against v2:

1:  5f72f07589 = 1:  0db9aad2bc repo: factor out field printing to dedicated function
2:  b8158bb7b8 ! 2:  b6ecdc2c2f repo: add --all to git-repo-info
    @@ Documentation/git-repo.adoc: THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHAN
      The values are returned in the same order in which their respective keys were
     -requested.
     +requested. The `--all` flag requests the values for all the available keys.
    -+Keys requested after `--all` will be duplicated.
      +
      The output format can be chosen through the flag `--format`. Two formats are
      supported:
    @@ builtin/repo.c: static int print_fields(int argc, const char **argv,
     +
     +	for (unsigned long i = 0; i < ARRAY_SIZE(repo_info_fields); i++) {
     +		struct field field = repo_info_fields[i];
    -+		get_value_fn *get_value = field.get_value;
    -+		const char *key = field.key;
     +
     +		strbuf_reset(&valbuf);
    -+		get_value(repo, &valbuf);
    -+		print_field(format, key, &valbuf, &quotbuf);
    ++		field.get_value(repo, &valbuf);
    ++		print_field(format, field.key, &valbuf, &quotbuf);
     +	}
     +
     +	strbuf_release(&valbuf);
    @@ builtin/repo.c: static int repo_info(int argc, const char **argv, const char *pr
      
      	argc = parse_options(argc, argv, prefix, options, repo_usage, 0);
      
    -+	if (all_keys)
    ++	if (all_keys) {
    ++		if (argc)
    ++			die(_("--all and <key> cannot be used together"));
    ++
     +		print_all_fields(repo, format);
    ++		return 0;
    ++	}
     +
      	return print_fields(argc, argv, repo, format);
      }
    @@ t/t1900-repo.sh: test_expect_success 'git repo info uses the last requested form
     +	test_cmp expect actual
     +'
     +
    -+test_expect_success 'git repo info --all <key> duplicates <key>' '
    -+	git repo info $REPO_INFO_KEYS object.format >expect &&
    -+	git repo info --all object.format >actual &&
    ++test_expect_success 'git repo info --all <key> aborts' '
    ++	echo "fatal: --all and <key> cannot be used together" >expect &&
    ++	test_must_fail git repo info --all object.format 2>actual &&
     +	test_cmp expect actual
     +'
    -+
    -+test_expect_success 'git repo info --all <invalid key> warns about invalid key' '
    -+	git repo info $REPO_INFO_KEYS >expect &&
    -+	echo "error: key ${SQ}no.key${SQ} not found" >expect_err &&
    -+	test_must_fail git repo info --all no.key >actual 2>actual_err &&
    -+	test_cmp expect actual &&
    -+	test_cmp expect_err actual_err
    -+'
     +
      test_done

Lucas Seiki Oshiro (2):
  repo: factor out field printing to dedicated function
  repo: add --all to git-repo-info

 Documentation/git-repo.adoc |  6 ++--
 builtin/repo.c              | 63 ++++++++++++++++++++++++++++---------
 t/t1900-repo.sh             | 21 +++++++++++++
 3 files changed, 72 insertions(+), 18 deletions(-)

-- 
2.50.1 (Apple Git-155)


  parent reply	other threads:[~2025-10-26 22:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 22:36 [PATCH] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-09-15 23:58 ` Junio C Hamano
2025-09-16  8:06 ` Patrick Steinhardt
2025-09-16 16:19   ` Junio C Hamano
2025-09-17  5:34     ` Patrick Steinhardt
2025-10-26 22:52 ` Lucas Seiki Oshiro [this message]
2025-10-26 22:52   ` [PATCH v3 1/2] repo: factor out field printing to dedicated function Lucas Seiki Oshiro
2025-10-26 23:53     ` Eric Sunshine
2025-10-26 23:56       ` Eric Sunshine
2025-10-27 14:56         ` Junio C Hamano
2025-10-27 16:09           ` Eric Sunshine
2025-10-26 22:52   ` [PATCH v3 2/2] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-10-27  0:22     ` Eric Sunshine
2025-10-27  0:24       ` Eric Sunshine
2025-11-17 15:02 ` [PATCH v4 0/2] " Lucas Seiki Oshiro
2025-11-17 15:02   ` [PATCH v4 1/2] repo: factor out field printing to dedicated function Lucas Seiki Oshiro
2025-11-17 18:48     ` Junio C Hamano
2025-11-17 15:02   ` [PATCH v4 2/2] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-11-17 18:58     ` Junio C Hamano
2025-11-18 20:16       ` Lucas Seiki Oshiro
2025-11-18 21:28         ` Junio C Hamano
2025-11-20 22:50           ` Lucas Seiki Oshiro
2025-11-19  7:32       ` Eric Sunshine
2025-11-19 14:33         ` Junio C Hamano
2025-11-17 18:14   ` [PATCH v4 0/2] " Junio C Hamano
2025-11-18 20:37 ` [PATCH v5 " Lucas Seiki Oshiro
2025-11-18 20:37   ` [PATCH v5 1/2] repo: factor out field printing to dedicated function Lucas Seiki Oshiro
2025-11-18 20:37   ` [PATCH v5 2/2] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-11-18 21:34   ` [PATCH v5 0/2] " Junio C Hamano
2025-11-19  7:35     ` Eric Sunshine

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=20251026225409.46647-1-lucasseikioshiro@gmail.com \
    --to=lucasseikioshiro@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=karthik.188@gmail$(echo .)com \
    --cc=ps@pks$(echo .)im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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