diff options
author | Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> | 2025-08-16 19:45:59 -0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-08-17 09:13:39 -0700 |
commit | ab94bb80002a85b31124f9ece8ba3843f93f063c (patch) | |
tree | 288cf5efb8b43cb5fb0cb9723d47a6f48c1d5ee5 /builtin/repo.c | |
parent | 16bd9f20a403117f2e0d9bcda6c6e621d3763e77 (diff) |
repo: declare the repo command
Currently, `git rev-parse` covers a wide range of functionality not
directly related to parsing revisions, as its name suggests. Over time,
many features like parsing datestrings, options, paths, and others
were added to it because there wasn't a more appropriate command
to place them.
Create a new Git command called `repo`. `git repo` will be the main
command for obtaining the information about a repository (such as
metadata and metrics).
Also declare a subcommand for `repo` called `info`. `git repo info`
will bring the functionality of retrieving repository-related
information currently returned by `rev-parse`.
Add the required documentation and build changes to enable usage of
this subcommand.
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Justin Tobler <jltobler@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/repo.c')
-rw-r--r-- | builtin/repo.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/builtin/repo.c b/builtin/repo.c new file mode 100644 index 0000000000..fd2a9b4216 --- /dev/null +++ b/builtin/repo.c @@ -0,0 +1,27 @@ +#include "builtin.h" +#include "parse-options.h" + +static const char *const repo_usage[] = { + "git repo info [<key>...]", + NULL +}; + +static int repo_info(int argc UNUSED, const char **argv UNUSED, + const char *prefix UNUSED, struct repository *repo UNUSED) +{ + return 0; +} + +int cmd_repo(int argc, const char **argv, const char *prefix, + struct repository *repo) +{ + parse_opt_subcommand_fn *fn = NULL; + struct option options[] = { + OPT_SUBCOMMAND("info", &fn, repo_info), + OPT_END() + }; + + argc = parse_options(argc, argv, prefix, options, repo_usage, 0); + + return fn(argc, argv, prefix, repo); +} |