Lucas Seiki Oshiro <lucasseikioshiro@xxxxxxxxx> writes: > 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@xxxxxxxxx> > Mentored-by Patrick Steinhardt <ps@xxxxxx> > Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@xxxxxxxxx> > --- > 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. > #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 << 1 Style: If we're doing this, then it also makes sense to use `1 << 0`. > }; > > 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]
Attachment:
signature.asc
Description: PGP signature