Subject: [PATCH v1 18/25] structured-logging: add aux-data for size of sparse-checkout file

From: [email-masked]
Date: Fri, 13 Jul 2018 16:56:14 +0000

From: Jeff Hostetler <[email-masked]>

Teach unpack_trees() to record the number of entries in the sparse-checkout
file in the aux-data.  This will be reported in the "cmd_exit" event.

Signed-off-by: Jeff Hostetler <[email-masked]>
---
 unpack-trees.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index 3a85a02..71b1b93 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1285,8 +1285,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 		char *sparse = git_pathdup("info/sparse-checkout");
 		if (add_excludes_from_file_to_list(sparse, "", 0, &el, NULL) < 0)
 			o->skip_sparse_checkout = 1;
-		else
+		else {
 			o->el = &el;
+			slog_aux_intmax("index", "sparse_checkout_count", el.nr);
+		}
 		free(sparse);
 	}
 
-- 
2.9.3