Thread (178 messages) 178 messages, 10 authors, 2025-08-16

Re: [GSoC RFC PATCH 4/5] repo-info: add field layout.bare

From: Karthik Nayak <hidden>
Date: 2025-06-11 13:13:38

Lucas Seiki Oshiro [off-list ref] writes:
quoted hunk ↗ jump to hunk
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 [off-list ref]
Mentored-by Patrick Steinhardt [off-list ref]
Signed-off-by: Lucas Seiki Oshiro <redacted>
---
 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.
quoted hunk ↗ jump to hunk
 #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]

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help