Skip to content

repo: add --all to git-repo-info

Lucas Seiki Oshiro git 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 2 repliesIn review
  2. v42 patches 8 repliesSuperseded
  3. v32 patches 6 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v22 patches3 repliesSuperseded
v11 patch4 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2repo: factor out field printing to dedicated functionbuiltin/repo.c+18 -160 replies
2/2repo: add --all to git-repo-infoDocumentation/git-repo.adoc builtin/repo.c t/t1900-repo.sh+51 -50 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchKarthik NayakPatrick Steinhardt
1/2
2/2Helped-by Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/2] repo: add --all to git-repo-info

Hi!

This v5 addresses the issues pointed by Junio in the previous versions. They are two small changes:

- print_all_fields now has the same signature print_fields

- now it uses size_t instead of unsigned long in a for loop

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, 69 insertions(+), 21 deletions(-)

Range-diff against v4:
1: fce09770b8 ! 1: c792715fdd repo: factor out field printing to dedicated function
@@ Commit message
print_field, allowing it to be called by functions other than print_fields.

+ Also change its use of quote_c_style() helper to output directly to
+ the standard output stream, instead of taking a result in a strbuf
+ and then printing it outselves.
+

## builtin/repo.c ##
2: ccdad86123 ! 2: b309d0e13c repo: add --all to git-repo-info

    @@ builtin/repo.c: static int print_fields(int argc, const char **argv,
      	return ret;
      }
      
    -+static void print_all_fields(struct repository *repo,
    -+			     enum output_format format)
    ++static int print_all_fields(struct repository *repo,
    ++			    enum output_format format)
     +{
     +	struct strbuf valbuf = STRBUF_INIT;
     +
    -+	for (unsigned long i = 0; i < ARRAY_SIZE(repo_info_fields); i++) {
    ++	for (size_t i = 0; i < ARRAY_SIZE(repo_info_fields); i++) {
     +		const struct field *field = &repo_info_fields[i];
     +
     +		strbuf_reset(&valbuf);
    @@ builtin/repo.c: static int print_fields(int argc, const char **argv,
     +	}
     +
     +	strbuf_release(&valbuf);
    ++	return 0;
     +}
     +
      static int parse_format_cb(const struct option *opt,
    @@ builtin/repo.c: static int cmd_repo_info(int argc, const char **argv, const char
      	if (format != FORMAT_KEYVALUE && format != FORMAT_NUL_TERMINATED)
      		die(_("unsupported output format"));
      
    -+	if (all_keys) {
    -+		if (argc)
    -+			die(_("--all and <key> cannot be used together"));
    +-	return print_fields(argc, argv, repo, format);
    ++	if (all_keys && argc)
    ++		die(_("--all and <key> cannot be used together"));
     +
    -+		print_all_fields(repo, format);
    -+		return 0;
    -+	}
    -+
    - 	return print_fields(argc, argv, repo, format);
    ++	if (all_keys)
    ++		return print_all_fields(repo, format);
    ++	else
    ++		return print_fields(argc, argv, repo, format);
      }
      
    + struct ref_stats {
     
      ## t/t1900-repo.sh ##
     @@ t/t1900-repo.sh: test_description='test git repo-info'
Signature · 1 line
2.50.1 (Apple Git-155)