repo: add the field layout.bare
This commit is part of the series that introduces the new subcommand git-repo-info. The flag --is-bare-repository from git-rev-parse is used for retrieving whether the current repository is bare. This way, it is used for querying repository metadata, fitting in the purpose of git-repo-info. Then, add a new field layout.bare 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>
This commit is contained in:
committed by
Junio C Hamano
parent
9adb8a7fd1
commit
acf2669b54
@@ -1,4 +1,7 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
|
||||
#include "builtin.h"
|
||||
#include "environment.h"
|
||||
#include "parse-options.h"
|
||||
#include "quote.h"
|
||||
#include "refs.h"
|
||||
@@ -16,6 +19,12 @@ struct field {
|
||||
get_value_fn *get_value;
|
||||
};
|
||||
|
||||
static int get_layout_bare(struct repository *repo UNUSED, struct strbuf *buf)
|
||||
{
|
||||
strbuf_addstr(buf, is_bare_repository() ? "true" : "false");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_references_format(struct repository *repo, struct strbuf *buf)
|
||||
{
|
||||
strbuf_addstr(buf,
|
||||
@@ -25,6 +34,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 },
|
||||
{ "references.format", get_references_format },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user