Lucas Seiki Oshiro <lucasseikioshiro@xxxxxxxxx> writes: > Add the --format flag to git-repo-info. By using this flag, the users > can choose the format for obtaining the data they requested. > > Given that this command can be used for generating input for other > applications and for being read by end users, it requires at least two > formats: one for being read by humans and other for being read by > machines. Some other Git commands also have two output formats, notably > git-config which was the inspiration for the two formats that were > chosen here: > > - keyvalue, where the retrieved data is printed one per line, using = > for delimiting the key and the value. This is the default format, > targeted for end users. > - nul, where the retrieved data is separated by null characters, using These characters are commonly spelled "NUL characters". $ git grep -i -e 'NUL ch' -e 'NULL ch' Documentation/ Same for the explanation for the "nul" in the documentation. > + > + switch (format) { > + case FORMAT_KEYVALUE: > + quote_c_style(valbuf.buf, "buf, NULL, 0); > + printf("%s=%s\n", key, quotbuf.buf); > + break; > + case FORMAT_NUL_TERMINATED: > + printf("%s\n%s%c", key, valbuf.buf, '\0'); > + break; > + default: > + BUG("not a valid output format: %d", format); > + } OK. > diff --git a/t/t1900-repo.sh b/t/t1900-repo.sh > index 78766a3f4f..a4ec6b42df 100755 > --- a/t/t1900-repo.sh > +++ b/t/t1900-repo.sh > @@ -21,12 +21,22 @@ test_repo_info () { > key=$4 > expected_value=$5 > > - 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 && > + 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 > + ' > } This is curious. If my understanding is correct, the --format=nul/keyvalue affects only the output format when "repo info" is executed. I do not see why we need two separate repositories.