From: Junio C Hamano Date: Thu, 6 Nov 2025 23:17:33 +0000 (-0800) Subject: Merge branch 'lo/repo-info-all' into seen X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64e8f345028bb34584809393f38c9f4163d39a23;p=thirdparty%2Fgit.git Merge branch 'lo/repo-info-all' into seen "git repo info" learned "--all" option. * lo/repo-info-all: repo: add --all to git-repo-info repo: factor out field printing to dedicated function --- 64e8f345028bb34584809393f38c9f4163d39a23 diff --cc Documentation/git-repo.adoc index ce43cb19c8,e61af9ce3b..70f0a6d2e4 --- a/Documentation/git-repo.adoc +++ b/Documentation/git-repo.adoc @@@ -8,8 -8,7 +8,8 @@@ git-repo - Retrieve information about t SYNOPSIS -------- [synopsis] - git repo info [--format=(keyvalue|nul)] [-z] [...] + git repo info [--format=(keyvalue|nul)] [-z] [--all | ...] +git repo structure [--format=(table|keyvalue|nul)] DESCRIPTION ----------- diff --cc builtin/repo.c index f26640bd6e,67d647bb3c..9c3da1a975 --- a/builtin/repo.c +++ b/builtin/repo.c @@@ -3,20 -3,13 +3,20 @@@ #include "builtin.h" #include "environment.h" #include "parse-options.h" +#include "path-walk.h" +#include "progress.h" #include "quote.h" +#include "ref-filter.h" #include "refs.h" +#include "revision.h" #include "strbuf.h" +#include "string-list.h" #include "shallow.h" +#include "utf8.h" static const char *const repo_usage[] = { - "git repo info [--format=(keyvalue|nul)] [-z] [...]", + "git repo info [--format=(keyvalue|nul)] [-z] [--all | ...]", + "git repo structure [--format=(table|keyvalue|nul)]", NULL }; @@@ -146,10 -159,11 +169,11 @@@ static int parse_format_cb(const struc return 0; } -static int repo_info(int argc, const char **argv, const char *prefix, - struct repository *repo) +static int cmd_repo_info(int argc, const char **argv, const char *prefix, + struct repository *repo) { enum output_format format = FORMAT_KEYVALUE; + int all_keys = 0; struct option options[] = { OPT_CALLBACK_F(0, "format", &format, N_("format"), N_("output format"), @@@ -162,9 -177,15 +187,17 @@@ }; argc = parse_options(argc, argv, prefix, options, repo_usage, 0); + if (format != FORMAT_KEYVALUE && format != FORMAT_NUL_TERMINATED) + die(_("unsupported output format")); + if (all_keys) { + if (argc) + die(_("--all and cannot be used together")); + + print_all_fields(repo, format); + return 0; + } + return print_fields(argc, argv, repo, format); }