From c813a7c35f44f4bf435c6ecb21bf4b9ec8f227de Mon Sep 17 00:00:00 2001 From: Matthew DeVore Date: Tue, 8 Jan 2019 18:59:13 -0800 Subject: list-objects-filter: teach tree:# how to handle >0 Implement positive values for in the tree: filter. The exact semantics are described in Documentation/rev-list-options.txt. The long-term goal at the end of this is to allow a partial clone to eagerly fetch an entire directory of files by fetching a tree and specifying =1. This, for instance, would make a build operation fast and convenient. It is fast because the partial clone does not need to fetch each file individually, and convenient because the user does not need to supply a sparse-checkout specification. Another way of considering this feature is as a way to reduce round-trips, since the client can get any number of levels of directories in a single request, rather than wait for each level of tree objects to come back, whose entries are used to construct a new request. Signed-off-by: Matthew DeVore Reviewed-by: Jonathan Tan Signed-off-by: Junio C Hamano --- list-objects-filter-options.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'list-objects-filter-options.c') diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index e8da2e8581..5285e7674d 100644 --- a/list-objects-filter-options.c +++ b/list-objects-filter-options.c @@ -50,16 +50,15 @@ static int gently_parse_list_objects_filter( } } else if (skip_prefix(arg, "tree:", &v0)) { - unsigned long depth; - if (!git_parse_ulong(v0, &depth) || depth != 0) { + if (!git_parse_ulong(v0, &filter_options->tree_exclude_depth)) { if (errbuf) { strbuf_addstr( errbuf, - _("only 'tree:0' is supported")); + _("expected 'tree:'")); } return 1; } - filter_options->choice = LOFC_TREE_NONE; + filter_options->choice = LOFC_TREE_DEPTH; return 0; } else if (skip_prefix(arg, "sparse:oid=", &v0)) { -- cgit v1.2.3