diff mbox series

[RFC,07/20] cat-file: remove skip_object_info

Message ID 0102016915f49a52-284c872e-17ab-4bfb-befd-2720b48fcbbe-000000@eu-west-1.amazonses.com (mailing list archive)
State New, archived
Headers show
Series [RFC,01/20] cat-file: reuse struct ref_format | expand

Commit Message

Olga Telezhnaya Feb. 22, 2019, 4:05 p.m. UTC
Get rid of skip_object_info field in struct expand_data.
expand_data may be global further as we use it in ref-filter also,
so we need to remove cat-file specific fields from it.

All globals that I add through this patch will be deleted in the end,
so treat it just as the middle step.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
---
 builtin/cat-file.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)


--
https://github.com/git/git/pull/568

Comments

Jeff King Feb. 28, 2019, 9:26 p.m. UTC | #1
On Fri, Feb 22, 2019 at 04:05:45PM +0000, Olga Telezhnaya wrote:

> Get rid of skip_object_info field in struct expand_data.
> expand_data may be global further as we use it in ref-filter also,
> so we need to remove cat-file specific fields from it.
> 
> All globals that I add through this patch will be deleted in the end,
> so treat it just as the middle step.

OK, makes sense in the same way that the previous patch does. I actually
wonder if it would make sense to just do them all in a single patch; the
justification is identical for all cases. But I'm also OK leaving them
separate.

-Peff
diff mbox series

Patch

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 9bcb02fad1f0d..f6470380f55b3 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -29,8 +29,9 @@  struct batch_options {
 };
 
 static const char *force_path;
-/* Will be deleted at the end of this patch */
+/* Next 2 vars will be deleted at the end of this patch */
 static int mark_query;
+static int skip_object_info;
 
 static int filter_object(const char *path, unsigned mode,
 			 const struct object_id *oid,
@@ -205,13 +206,6 @@  struct expand_data {
 	 * elements above, so you can retrieve the response from there.
 	 */
 	struct object_info info;
-
-	/*
-	 * This flag will be true if the requested batch format and options
-	 * don't require us to call oid_object_info, which can then be
-	 * optimized out.
-	 */
-	unsigned skip_object_info : 1;
 };
 
 static int is_atom(const char *atom, const char *s, int slen)
@@ -343,7 +337,7 @@  static void batch_object_write(const char *obj_name,
 			       struct batch_options *opt,
 			       struct expand_data *data)
 {
-	if (!data->skip_object_info &&
+	if (!skip_object_info &&
 	    oid_object_info_extended(the_repository, &data->oid, &data->info,
 				     OBJECT_INFO_LOOKUP_REPLACE) < 0) {
 		printf("%s missing\n",
@@ -494,7 +488,7 @@  static int batch_objects(struct batch_options *opt)
 	if (opt->all_objects) {
 		struct object_info empty = OBJECT_INFO_INIT;
 		if (!memcmp(&data.info, &empty, sizeof(empty)))
-			data.skip_object_info = 1;
+			skip_object_info = 1;
 	}
 
 	/*