Partial clone part 1: object filtering
v6 cover Partial clone part 1: object filtering
From: Jeff Hostetler <[email protected]>
Here is V6 of the list-object filtering, rev-list, and pack-objects.
This is an incremental patch series to be applied on top of V5 which is already in 'next'.
This version fixes a typo, add the --no-filter option, eliminates a couple of asserts(), and updates the documentation.
Christian Couder (1):
list-objects-filter-options: fix 'keword' typo in comment
Jeff Hostetler (2):
list-objects-filter-options: support --no-filter
rev-list: support --no-filter argument
Documentation/git-pack-objects.txt | 3 +++ Documentation/rev-list-options.txt | 15 ++++++++++----- builtin/rev-list.c | 4 ++++ list-objects-filter-options.c | 17 ++++++++++++++--- list-objects-filter-options.h | 5 ++++- 5 files changed, 35 insertions(+), 9 deletions(-)
Signature · 1 line
2.9.3
PATCH v6 1/3 list-objects-filter-options: fix 'keword' typo in comment
From: Christian Couder <[email protected]>
--- list-objects-filter-options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
list-objects-filter-options.c +1 -1
@@ -8,7 +8,7 @@#include "list-objects-filter-options.h" /* -* Parse value of the argument to the "filter" keword. +* Parse value of the argument to the "filter" keyword. * On the command line this looks like: * --filter=<arg> * and in the pack protocol as:
Signature · 1 line
2.9.3
PATCH v6 2/3 list-objects-filter-options: support --no-filter
In reply to Jeff HostetlerFrom: Jeff Hostetler <[email protected]>
Teach opt_parse_list_objects_filter() to take --no-filter option and to free the contents of struct filter_options. This command line argument will be automatically inherited by commands using OPT_PARSE_LIST_OBJECTS_FILTER(); this includes pack-objects.
--- Documentation/git-pack-objects.txt | 3 +++ list-objects-filter-options.c | 15 +++++++++++++-- list-objects-filter-options.h | 5 ++++- 3 files changed, 20 insertions(+), 3 deletions(-)
Documentation/git-pack-objects.txt +3 -0
@@ -242,6 +242,9 @@ So does `git bundle` (see linkgit:git-bundle[1]) when it creates a bundle. the resulting packfile. See linkgit:git-rev-list[1] for valid `<filter-spec>` forms. +--no-filter:: + Turns off any previous `--filter=` argument. + --missing=<missing-action>:: A debug option to help with future "partial clone" development. This option specifies how missing objects are handled.
list-objects-filter-options.c +13 -2
@@ -74,8 +74,19 @@ int opt_parse_list_objects_filter(const struct option *opt, {struct list_objects_filter_options *filter_options = opt->value; -assert (arg); -assert (!unset); +if (unset || !arg) { +list_objects_filter_release (filter_options); +return 0 ; + }return parse_list_objects_filter (filter_options, arg); } + +void list_objects_filter_release ( +struct list_objects_filter_options *filter_options) +{ +free (filter_options->filter_spec); +free (filter_options->sparse_oid_value); +free (filter_options->sparse_path_value); +memset (filter_options,0 ,sizeof (*filter_options)); +}
list-objects-filter-options.h +4 -1
@@ -52,7 +52,10 @@ int opt_parse_list_objects_filter(const struct option *opt,#define OPT_PARSE_LIST_OBJECTS_FILTER (fo) \ { OPTION_CALLBACK, 0, CL_ARG__FILTER, fo, N_("args"), \ - N_("object filtering"), PARSE_OPT_NONEG, \ + N_("object filtering"), 0, \ opt_parse_list_objects_filter } +void list_objects_filter_release ( +struct list_objects_filter_options *filter_options); +#endif /* LIST_OBJECTS_FILTER_OPTIONS_H */
Signature · 1 line
2.9.3
PATCH v6 3/3 rev-list: support --no-filter argument
In reply to Jeff HostetlerFrom: Jeff Hostetler <[email protected]>
Teach rev-list to support --no-filter to override a previous --filter=<filter_spec> argument. This is to be consistent with commands that use OPT_PARSE macros.
--- Documentation/rev-list-options.txt | 15 ++++++++++----- builtin/rev-list.c | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-)
Documentation/rev-list-options.txt +10 -5
@@ -715,16 +715,21 @@ ifdef::git-rev-list[] The form '--filter=blob:none' omits all blobs. + The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes -or units. The value may be zero. +or units. n may be zero. The suffixes k, m, and g can be used to name +units in KiB, MiB, or GiB. For example, 'blob:limit=1k' is the same +as 'blob:limit=1024'. + -The form '--filter=sparse:oid=<oid-ish>' uses a sparse-checkout -specification contained in the object (or the object that the expression -evaluates to) to omit blobs that would not be not required for a -sparse checkout on the requested refs. +The form '--filter=sparse:oid=<blob-ish>' uses a sparse-checkout +specification contained in the blob (or blob-expression) '<blob-ish>' +to omit blobs that would not be not required for a sparse checkout on +the requested refs. + The form '--filter=sparse:path=<path>' similarly uses a sparse-checkout specification contained in <path>. +--no-filter:: + Turn off any previous `--filter=` argument. + --filter-print-omitted:: Only useful with `--filter=`; prints a list of the objects omitted by the filter. Object IDs are prefixed with a ``~'' character.
builtin/rev-list.c +4 -0
@@ -403,6 +403,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) filter_options.filter_spec);continue ; } +if (!strcmp (arg, ("--no-" CL_ARG__FILTER ))) { +list_objects_filter_release (&filter_options); +continue ; + }if (!strcmp (arg,"--filter-print-omitted" )) { arg_print_omitted =1 ;continue ;
Signature · 1 line
2.9.3
Re: [PATCH v6 3/3] rev-list: support --no-filter argument
Quoted 18 lines · Jeff Hostetler
From: Jeff Hostetler <[email protected]>
Teach rev-list to support --no-filter to override a previous --filter=<filter_spec> argument. This is to be consistent with commands that use
OPT_PARSEmacros.Signed-off-by Jeff Hostetler <[email protected]>--- Documentation/rev-list-options.txt | 15 ++++++++++----- builtin/rev-list.c | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-)Documentation/rev-list-options.txt +0
-0
Documentation/rev-list-options.txt ifdef::git-rev-list[] · line 718
Quoted 5 lines
Documentation/rev-list-options.txt +1
-1@@ -715,16 +715,21 @@ ifdef::git-rev-list[] The form '--filter=blob:none' omits all blobs. + The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes -or units. The value may be zero. +or units. n may be zero. The suffixes k, m, and g can be used to name
"'<n>' may be zero" would be more consistent with other parts of this file. s/k, m, and g/'k', 'm', and 'g'/ could also help.
Documentation/rev-list-options.txt ifdef::git-rev-list[] · line 723
Quoted 9 lines
Documentation/rev-list-options.txt +4
-4+units in KiB, MiB, or GiB. For example, 'blob:limit=1k' is the same +as 'blob:limit=1024'. + -The form '--filter=sparse:oid=<oid-ish>' uses a sparse-checkout -specification contained in the object (or the object that the expression -evaluates to) to omit blobs that would not be not required for a -sparse checkout on the requested refs. +The form '--filter=sparse:oid=<blob-ish>' uses a sparse-checkout +specification contained in the blob (or blob-expression) '<blob-ish>'
For example here '<blob-ish>' is used.
Quoted 2 lines
Documentation/rev-list-options.txt +2
-0+to omit blobs that would not be not required for a sparse checkout on +the requested refs.
Re: [PATCH v6 3/3] rev-list: support --no-filter argument
Quoted 14 lines · Christian Couder
Quoted 13 lines · Jeff Hostetler
From: Jeff Hostetler <[email protected]>
Teach rev-list to support --no-filter to override a previous --filter=<filter_spec> argument. This is to be consistent with commands that use
OPT_PARSEmacros.Signed-off-by Jeff Hostetler <[email protected]>--- Documentation/rev-list-options.txt | 15 ++++++++++----- builtin/rev-list.c | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-)
Quoted 13 lines
Documentation/rev-list-options.txt ifdef::git-rev-list[] · line 718
Quoted 10 lines
Documentation/rev-list-options.txt +1
-1@@ -715,16 +715,21 @@ ifdef::git-rev-list[] The form '--filter=blob:none' omits all blobs. + The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes -or units. The value may be zero. +or units. n may be zero. The suffixes k, m, and g can be used to name"'<n>' may be zero" would be more consistent with other parts of this file. s/k, m, and g/'k', 'm', and 'g'/ could also help.
good catch. thanks.
jeff