rev-list: support --no-filter argument
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff Hostetler committed
Dec 5, 2017 at 16:50 UTC
f4371a883fa2d740d6b3cd436f62c9b56f13432e
2 files changed
+14
-5
Documentation/rev-list-options.txt
+10
-5
@@ -715,16 +715,21 @@ ifdef::git-rev-list[]
715
The form '--filter=blob:none' omits all blobs.
716
+
717
The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes
718
-or units. The value may be zero.
718
+or units. n may be zero. The suffixes k, m, and g can be used to name
719
+units in KiB, MiB, or GiB. For example, 'blob:limit=1k' is the same
720
+as 'blob:limit=1024'.
721
+
720
-The form '--filter=sparse:oid=<oid-ish>' uses a sparse-checkout
721
-specification contained in the object (or the object that the expression
722
-evaluates to) to omit blobs that would not be not required for a
723
-sparse checkout on the requested refs.
722
+The form '--filter=sparse:oid=<blob-ish>' uses a sparse-checkout
723
+specification contained in the blob (or blob-expression) '<blob-ish>'
724
+to omit blobs that would not be not required for a sparse checkout on
725
+the requested refs.
726
+
727
The form '--filter=sparse:path=<path>' similarly uses a sparse-checkout
728
specification contained in <path>.
729
730
+--no-filter::
731
+ Turn off any previous `--filter=` argument.
732
+
733
--filter-print-omitted::
734
Only useful with `--filter=`; prints a list of the objects omitted
735
by the filter. Object IDs are prefixed with a ``~'' character.
builtin/rev-list.c
+4
@@ -403,6 +403,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
403
filter_options.filter_spec);
404
continue;
405
}
406
+ if (!strcmp(arg, ("--no-" CL_ARG__FILTER))) {
407
+ list_objects_filter_release(&filter_options);
408
+ continue;
409
+ }
410
if (!strcmp(arg, "--filter-print-omitted")) {
411
arg_print_omitted = 1;
412
continue;