Skip to content

Commit f4371a8

Browse files
jeffhostetlergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4875c97 commit f4371a8

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Documentation/rev-list-options.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -715,16 +715,21 @@ ifdef::git-rev-list[]
715715
The form '--filter=blob:none' omits all blobs.
716716
+
717717
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'.
719721
+
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.
724726
+
725727
The form '--filter=sparse:path=<path>' similarly uses a sparse-checkout
726728
specification contained in <path>.
727729

730+
--no-filter::
731+
Turn off any previous `--filter=` argument.
732+
728733
--filter-print-omitted::
729734
Only useful with `--filter=`; prints a list of the objects omitted
730735
by the filter. Object IDs are prefixed with a ``~'' character.

builtin/rev-list.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
403403
filter_options.filter_spec);
404404
continue;
405405
}
406+
if (!strcmp(arg, ("--no-" CL_ARG__FILTER))) {
407+
list_objects_filter_release(&filter_options);
408+
continue;
409+
}
406410
if (!strcmp(arg, "--filter-print-omitted")) {
407411
arg_print_omitted = 1;
408412
continue;

0 commit comments

Comments
 (0)