aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2017-12-05 16:50:14 +0000
committerJunio C Hamano <gitster@pobox.com>2017-12-05 09:44:37 -0800
commitf4371a883fa2d740d6b3cd436f62c9b56f13432e (patch)
tree3d4adf06a24546df273175d6890c9fd8d9f457ba
parent4875c9791e787af07992d3ba30061885322b7d11 (diff)
downloadgit-f4371a883fa2d740d6b3cd436f62c9b56f13432e.tar.gz
git-f4371a883fa2d740d6b3cd436f62c9b56f13432e.tar.xz
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>
-rw-r--r--Documentation/rev-list-options.txt15
-rw-r--r--builtin/rev-list.c4
2 files changed, 14 insertions, 5 deletions
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 11bb87f3d..8d8b7f492 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 71e3dfc46..159b035a2 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;