Re: [GSoC RFC PATCH v4 1/4] repo: declare the repo command
From: Justin Tobler <hidden>
Date: 2025-07-15 18:25:28
On 25/07/14 08:52PM, Lucas Seiki Oshiro wrote:
Currently, `git rev-parse` covers a wide range of functionality not directly related to parsing revisions, as its name says. Over time,
s/says/suggests/
many features like parsing datestrings, options, paths, and others were added to it because there wasn't a more appropriated command
s/appropriated/appropriate/
quoted hunk ↗ jump to hunk
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), returning them in a machine readable format following the syntax "field<LF>value<NUL>". 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`. Also add entries for this new command in: - the build files (Makefile, meson.build, Documentation/meson.build) - builtin.h - git.c - .gitignore - command-list.txt - Documentation Helped-by: Phillip Wood [off-list ref] Helped-by: Junio C Hamano [off-list ref] Helped-by: Justin Tobler [off-list ref] Mentored-by: Karthik Nayak [off-list ref] Mentored-by: Patrick Steinhardt [off-list ref] Signed-off-by: Lucas Seiki Oshiro <redacted> --- .gitignore | 1 + Documentation/git-repo.adoc | 54 +++++++++++++++++++++++++++++++++++++ Documentation/meson.build | 1 + Makefile | 1 + builtin.h | 1 + builtin/repo.c | 38 ++++++++++++++++++++++++++ command-list.txt | 1 + git.c | 1 + meson.build | 1 + 9 files changed, 99 insertions(+) create mode 100644 Documentation/git-repo.adoc create mode 100644 builtin/repo.cdiff --git a/.gitignore b/.gitignore index 04c444404e..1803023427 100644 --- a/.gitignore +++ b/.gitignore@@ -139,6 +139,7 @@ /git-repack /git-replace /git-replay +/git-repo /git-request-pull /git-rerere /git-resetdiff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc new file mode 100644 index 0000000000..6f8fe3f6ea --- /dev/null +++ b/Documentation/git-repo.adoc@@ -0,0 +1,54 @@ +git-repo(1) +=========== + +NAME +---- +git-repo - Retrieve information about a repository + +SYNOPSIS +-------- +[synopsis] +git repo info [<key>...] + +DESCRIPTION +----------- +Retrieve information about the current repository in a machine-readable format. + +`git repo` will be the primary tool to query repository-specific information, +such as metadata that currently can also be done by calling `git rev-parse` (see +linkgit:git-rev-parse[1]). `git repo` doesn't query information unrelated to the +current repository or that is already retrieved by a specialized command, for +example, `git config` (see linkgit:git-config[1]) or `git var` (see +linkgit:git-var[1]). + +This command returns the retrieved data following a null-terminated format with +this syntax: ++ +---------------- +key1<LF>value1<NUL> +key2<LF>value2<NUL> +... +----------------
Being that this patch doesn't yet implement any output for the command, maybe should should hold off on specifying the format. In other commands, it is common to see a nul-terminated format toggled behind a `-z` flag. We may want to do something similar here as opposed to being the default. -Justin