Re: [GSoC RFC PATCH v2 2/7] repo-info: add the --format flag
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jun 20, 2025, 08:06 UTC
- Message-ID
- <CAOLa=ZT=rwejgefvQcxwLBUS3ExoO_G_r0ruBoQZWKDR-LfzvQ@mail.gmail.com>
- In-Reply-To
- <20250619225751.99699-3-lucasseikioshiro@gmail.com>
Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> writes:
> Add the --format flag to the repo-info command, allowing the user to > choose between output formats. Use 'json' by default.
Similarly here, it would be nice to mention why we add 'json' formatting and why it is the default.
[snip]
Show 35 quoted lines
> diff --git a/t/meson.build b/t/meson.build
> index 50e89e764a..d9ecaba3b7 100644
> --- a/t/meson.build
> +++ b/t/meson.build
> @@ -246,6 +246,7 @@ integration_tests = [
> 't1700-split-index.sh',
> 't1701-racy-split-index.sh',
> 't1800-hook.sh',
> + 't1900-repo-info.sh',
> 't2000-conflict-when-checking-files-out.sh',
> 't2002-checkout-cache-u.sh',
> 't2003-checkout-cache-mkdir.sh',
> diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh
> new file mode 100755
> index 0000000000..f634e1a285
> --- /dev/null
> +++ b/t/t1900-repo-info.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +test_description='test git repo-info'
> +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
> +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
> +
> +. ./test-lib.sh
> +
> +parse_json () {
> + tr '\n' ' ' | "$PERL_PATH" "$TEST_DIRECTORY/t0019/parse_json.perl"
> +}
> +
> +test_lazy_prereq PERLJSON '
> + perl -MJSON -e "exit 0"
> +'
> +
> +test_expect_success PERLJSON 'json: returns empty output with allow-empty' 'Huh. Where is allow-empty being used? and why in this patch?
> + git repo-info --format=json >output && > + test_line_count = 2 output > +' >