git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH v6 0/3] Partial clone part 1: object filtering
@ 2017-12-05 16:50 Jeff Hostetler
  2017-12-05 16:50 ` [PATCH v6 1/3] list-objects-filter-options: fix 'keword' typo in comment Jeff Hostetler
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jeff Hostetler @ 2017-12-05 16:50 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, jonathantanmy, christian.couder, Jeff Hostetler

From: Jeff Hostetler <jeffhost@microsoft.com>

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(-)

-- 
2.9.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v6 1/3] list-objects-filter-options: fix 'keword' typo in comment
  2017-12-05 16:50 [PATCH v6 0/3] Partial clone part 1: object filtering Jeff Hostetler
@ 2017-12-05 16:50 ` Jeff Hostetler
  2017-12-05 16:50 ` [PATCH v6 2/3] list-objects-filter-options: support --no-filter Jeff Hostetler
  2017-12-05 16:50 ` [PATCH v6 3/3] rev-list: support --no-filter argument Jeff Hostetler
  2 siblings, 0 replies; 6+ messages in thread
From: Jeff Hostetler @ 2017-12-05 16:50 UTC (permalink / raw)
  To: git
  Cc: gitster, peff, jonathantanmy, christian.couder, Christian Couder,
	Jeff Hostetler

From: Christian Couder <christian.couder@gmail.com>

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
---
 list-objects-filter-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 9b28322..52bdec7 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -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:
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v6 2/3] list-objects-filter-options: support --no-filter
  2017-12-05 16:50 [PATCH v6 0/3] Partial clone part 1: object filtering Jeff Hostetler
  2017-12-05 16:50 ` [PATCH v6 1/3] list-objects-filter-options: fix 'keword' typo in comment Jeff Hostetler
@ 2017-12-05 16:50 ` Jeff Hostetler
  2017-12-05 16:50 ` [PATCH v6 3/3] rev-list: support --no-filter argument Jeff Hostetler
  2 siblings, 0 replies; 6+ messages in thread
From: Jeff Hostetler @ 2017-12-05 16:50 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, jonathantanmy, christian.couder, Jeff Hostetler

From: Jeff Hostetler <jeffhost@microsoft.com>

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.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
---
 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(-)

diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index b924c6c..aa403d0 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -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.
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 52bdec7..4c5b34e 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -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));
+}
diff --git a/list-objects-filter-options.h b/list-objects-filter-options.h
index dd7e5db..eea44a1 100644
--- a/list-objects-filter-options.h
+++ b/list-objects-filter-options.h
@@ -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 */
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v6 3/3] rev-list: support --no-filter argument
  2017-12-05 16:50 [PATCH v6 0/3] Partial clone part 1: object filtering Jeff Hostetler
  2017-12-05 16:50 ` [PATCH v6 1/3] list-objects-filter-options: fix 'keword' typo in comment Jeff Hostetler
  2017-12-05 16:50 ` [PATCH v6 2/3] list-objects-filter-options: support --no-filter Jeff Hostetler
@ 2017-12-05 16:50 ` Jeff Hostetler
  2017-12-11  6:17   ` Christian Couder
  2 siblings, 1 reply; 6+ messages in thread
From: Jeff Hostetler @ 2017-12-05 16:50 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, jonathantanmy, christian.couder, Jeff Hostetler

From: Jeff Hostetler <jeffhost@microsoft.com>

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.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
---
 Documentation/rev-list-options.txt | 15 ++++++++++-----
 builtin/rev-list.c                 |  4 ++++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 11bb87f..8d8b7f4 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -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.
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 4700473..547a3e0 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -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;
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v6 3/3] rev-list: support --no-filter argument
  2017-12-05 16:50 ` [PATCH v6 3/3] rev-list: support --no-filter argument Jeff Hostetler
@ 2017-12-11  6:17   ` Christian Couder
  2017-12-13 18:38     ` Jeff Hostetler
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Couder @ 2017-12-11  6:17 UTC (permalink / raw)
  To: Jeff Hostetler
  Cc: git, Junio C Hamano, Jeff King, Jonathan Tan, Jeff Hostetler

On Tue, Dec 5, 2017 at 5:50 PM, Jeff Hostetler <git@jeffhostetler.com> wrote:
> From: Jeff Hostetler <jeffhost@microsoft.com>
>
> 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.
>
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> ---
>  Documentation/rev-list-options.txt | 15 ++++++++++-----
>  builtin/rev-list.c                 |  4 ++++
>  2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
> index 11bb87f..8d8b7f4 100644
> --- a/Documentation/rev-list-options.txt
> +++ b/Documentation/rev-list-options.txt
> @@ -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.

> +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.

> +to omit blobs that would not be not required for a sparse checkout on
> +the requested refs.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v6 3/3] rev-list: support --no-filter argument
  2017-12-11  6:17   ` Christian Couder
@ 2017-12-13 18:38     ` Jeff Hostetler
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Hostetler @ 2017-12-13 18:38 UTC (permalink / raw)
  To: Christian Couder
  Cc: git, Junio C Hamano, Jeff King, Jonathan Tan, Jeff Hostetler



On 12/11/2017 1:17 AM, Christian Couder wrote:
> On Tue, Dec 5, 2017 at 5:50 PM, Jeff Hostetler <git@jeffhostetler.com> wrote:
>> From: Jeff Hostetler <jeffhost@microsoft.com>
>>
>> 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.
>>
>> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
>> ---
>>   Documentation/rev-list-options.txt | 15 ++++++++++-----
>>   builtin/rev-list.c                 |  4 ++++
>>   2 files changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
>> index 11bb87f..8d8b7f4 100644
>> --- a/Documentation/rev-list-options.txt
>> +++ b/Documentation/rev-list-options.txt
>> @@ -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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-13 18:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 16:50 [PATCH v6 0/3] Partial clone part 1: object filtering Jeff Hostetler
2017-12-05 16:50 ` [PATCH v6 1/3] list-objects-filter-options: fix 'keword' typo in comment Jeff Hostetler
2017-12-05 16:50 ` [PATCH v6 2/3] list-objects-filter-options: support --no-filter Jeff Hostetler
2017-12-05 16:50 ` [PATCH v6 3/3] rev-list: support --no-filter argument Jeff Hostetler
2017-12-11  6:17   ` Christian Couder
2017-12-13 18:38     ` Jeff Hostetler

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).