diff options
| author | Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> | 2025-08-16 19:46:02 -0300 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-08-17 09:13:40 -0700 |
| commit | e52cd654c9b21a98817578b8fd668da99053ee2b (patch) | |
| tree | 14ed20304d88d4ceca456dc74bd92981d082621b /builtin/repo.c | |
| parent | repo: add the field layout.bare (diff) | |
| download | git-e52cd654c9b21a98817578b8fd668da99053ee2b.tar.gz git-e52cd654c9b21a98817578b8fd668da99053ee2b.zip | |
repo: add the field layout.shallow
This commit is part of the series that introduces the new subcommand
git-repo-info.
The flag `--is-shallow-repository` from git-rev-parse is used for
retrieving whether the repository is shallow. This way, it is used for
querying repository metadata, fitting in the purpose of git-repo-info.
Then, add a new field `layout.shallow` to the git-repo-info subcommand
containing that information.
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 | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/repo.c b/builtin/repo.c index aada476e1c..3c9140593b 100644 --- a/builtin/repo.c +++ b/builtin/repo.c @@ -6,6 +6,7 @@ #include "quote.h" #include "refs.h" #include "strbuf.h" +#include "shallow.h" static const char *const repo_usage[] = { "git repo info [<key>...]", @@ -25,6 +26,13 @@ static int get_layout_bare(struct repository *repo UNUSED, struct strbuf *buf) return 0; } +static int get_layout_shallow(struct repository *repo, struct strbuf *buf) +{ + strbuf_addstr(buf, + is_repository_shallow(repo) ? "true" : "false"); + return 0; +} + static int get_references_format(struct repository *repo, struct strbuf *buf) { strbuf_addstr(buf, @@ -35,6 +43,7 @@ static int get_references_format(struct repository *repo, struct strbuf *buf) /* repo_info_fields keys must be in lexicographical order */ static const struct field repo_info_fields[] = { { "layout.bare", get_layout_bare }, + { "layout.shallow", get_layout_shallow }, { "references.format", get_references_format }, }; |
