]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'lo/repo-info-all' into seen
authorJunio C Hamano <gitster@pobox.com>
Thu, 6 Nov 2025 23:17:33 +0000 (15:17 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Nov 2025 23:17:33 +0000 (15:17 -0800)
"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

1  2 
Documentation/git-repo.adoc
builtin/repo.c

index ce43cb19c8b03cb0d0eed83090036135d1501803,e61af9ce3b8d059138c6c137629c67d3917c5684..70f0a6d2e472917e160cacedc5a013cc603d0599
@@@ -8,8 -8,7 +8,8 @@@ git-repo - Retrieve information about t
  SYNOPSIS
  --------
  [synopsis]
- git repo info [--format=(keyvalue|nul)] [-z] [<key>...]
+ git repo info [--format=(keyvalue|nul)] [-z] [--all | <key>...]
 +git repo structure [--format=(table|keyvalue|nul)]
  
  DESCRIPTION
  -----------
diff --cc builtin/repo.c
index f26640bd6ea1e75fc24de7fb80cc1cfd3eb54370,67d647bb3c72b949c3ef6d5e8e8bcac20e3f8ab8..9c3da1a9751978ce55b077a24709c470973c5645
@@@ -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] [<key>...]",
+       "git repo info [--format=(keyvalue|nul)] [-z] [--all | <key>...]",
 +      "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"),
        };
  
        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 <key> cannot be used together"));
+               print_all_fields(repo, format);
+               return 0;
+       }
        return print_fields(argc, argv, repo, format);
  }