Re: [GSoC RFC PATCH 4/5] repo-info: add field layout.bare
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jun 11, 2025, 13:13 UTC
- Message-ID
- <CAOLa=ZTvC7Hq5Fz6N1ESzf1s=7kkyZG5iYTA6pzxnKm2p4oMNw@mail.gmail.com>
- In-Reply-To
- <20250610152117.14826-5-lucasseikioshiro@gmail.com>
Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> writes:
Show 19 quoted lines
> Add the field layout.bare to the repo-info command. The data > retrieved in this field is the same that currently is obtained by > running `git rev-parse --is-bare-repository`. > > Mentored-by: Karthik Nayak <karthik.188@gmail.com> > Mentored-by Patrick Steinhardt <ps@pks.im> > Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> > --- > builtin/repo-info.c | 35 ++++++++++++++++++++++++++++++++++- > t/t1518-repo-info.sh | 12 ++++++++++-- > 2 files changed, 44 insertions(+), 3 deletions(-) > > diff --git a/builtin/repo-info.c b/builtin/repo-info.c > index a1c9d3942e..bc25a0809f 100644 > --- a/builtin/repo-info.c > +++ b/builtin/repo-info.c > @@ -1,4 +1,7 @@ > +#define USE_THE_REPOSITORY_VARIABLE > +
Ah! Seems like `is_bare_repository()` is responsible for this, it would be nice to not introduce global dependency in a new command, but this isn't part of your project, so it's okay here.
Show 12 quoted lines
> #include "builtin.h"
> +#include "environment.h"
> #include "hash.h"
> #include "json-writer.h"
> #include "parse-options.h"
> @@ -10,17 +13,22 @@ enum output_format {
> };
>
> enum repo_info_category {
> - CATEGORY_REFERENCES = 1
> + CATEGORY_REFERENCES = 1,
> + CATEGORY_LAYOUT = 1 << 1Style: If we're doing this, then it also makes sense to use `1 << 0`.
Show 9 quoted lines
> };
>
> enum repo_info_references_field {
> FIELD_REFERENCES_FORMAT = 1
> };
>
> +enum repo_info_layout_field { FIELD_LAYOUT_BARE = 1
> +};
> +Style: let's keep the styling consistent with the previous block.
[snip]