On Thu, Aug 7, 2025 at 11:04 AM Lucas Seiki Oshiro <lucasseikioshiro@xxxxxxxxx> wrote: > Add the --format flag to git-repo-info. By using this flag, the users > can choose the format for obtaining the data they requested. > [...] > Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@xxxxxxxxx> > --- > diff --git a/t/t1900-repo.sh b/t/t1900-repo.sh > @@ -21,12 +21,22 @@ test_repo_info () { > - test_expect_success "$label" ' > - eval "$init_command $repo_name" && > - echo "$key=$expected_value" >expected && > - git -C $repo_name repo info "$key" >actual && > + repo_name_keyvalue="$repo_name"-keyvalue > + repo_name_nul="$repo_name"-nul > + > + test_expect_success "keyvalue: $label" ' > + eval "$init_command $repo_name_keyvalue" && > + echo "$key=$expected_value" > expected && Style nit: drop space following redirection operator[1]. Not worth a reroll. > + git -C "$repo_name_keyvalue" repo info "$key" >actual && > test_cmp expected actual > ' > + > + test_expect_success "nul: $label" ' > + eval "$init_command $repo_name_nul" && > + printf "%s\n%s\0" "$key" "$expected_value" >expected && > + git -C "$repo_name_nul" repo info --format=nul "$key" >actual && > + test_cmp_bin expected actual > + ' > } > @@ -44,12 +54,15 @@ test_repo_info 'bare repository = true is retrieved correctly' \ > test_expect_success 'git-repo-info fails if an invalid key is requested' ' > echo "error: key ${SQ}foo${SQ} not found" >expected_err && Nit: Here you used ${SQ} as suggested by Karthik[2]... > @@ -80,4 +93,10 @@ test_expect_success 'output is returned correctly when two keys are requested' ' > +test_expect_success 'git-repo-info aborts when requesting an invalid format' ' > + echo "fatal: invalid format '\'foo\''" >expected && ...but here you did not. > + test_must_fail git repo info --format=foo 2>err && > + test_cmp expected err > +' [1]: https://lore.kernel.org/git/aJQ3sVf4MsgnCaMz@xxxxxx/ [2]: https://lore.kernel.org/git/CAOLa=ZSX0hFt7PRdXssz2xGG17bmDchS=EheBSmQj9xr+r_baA@xxxxxxxxxxxxxx/