On 8/19/2018 7:24 AM, Duy Nguyen wrote:
On Fri, Dec 8, 2017 at 5:00 PM Jeff Hostetler <g...@jeffhostetler.com> wrote:

From: Jeff Hostetler <jeffh...@microsoft.com>

Teach fetch to support filters. This is only allowed for the remote
configured in extensions.partialcloneremote.

Signed-off-by: Jonathan Tan <jonathanta...@google.com>
---
  builtin/fetch.c       | 23 +++++++++++++++++++++--
  connected.c           |  2 ++
  remote-curl.c         |  6 ++++++
  t/t5500-fetch-pack.sh | 36 ++++++++++++++++++++++++++++++++++++
  4 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 1b1f039..14aab71 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -18,6 +18,7 @@
  #include "argv-array.h"
  #include "utf8.h"
  #include "packfile.h"
+#include "list-objects-filter-options.h"

  static const char * const builtin_fetch_usage[] = {
         N_("git fetch [<options>] [<repository> [<refspec>...]]"),
@@ -55,6 +56,7 @@ static int recurse_submodules_default = 
RECURSE_SUBMODULES_ON_DEMAND;
  static int shown_url = 0;
  static int refmap_alloc, refmap_nr;
  static const char **refmap_array;
+static struct list_objects_filter_options filter_options;

  static int git_fetch_config(const char *k, const char *v, void *cb)
  {
@@ -160,6 +162,7 @@ static struct option builtin_fetch_options[] = {
                         TRANSPORT_FAMILY_IPV4),
         OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"),
                         TRANSPORT_FAMILY_IPV6),
+       OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),

Documentation is missing. Please add something to git-fetch.txt (or
fetch-options.txt) about this option. I would make a patch but I don't
know enough about this to write and I'm in the middle of something
else.


Documentation for --filter=<fs> (and --no-filter) were added to
rev-list-options.txt.  The opening paragraph talks about --objects
which would need to be omitted for fetch and clone, but the rest
of that text is relevant.

I'll push up a patch shortly.

Thanks
Jeff

Reply via email to