return result;
  }
  
- static int fetch_one(struct remote *remote, int argc, const char **argv)
 +/*
 + * Fetching from the promisor remote should use the given filter-spec
 + * or inherit the default filter-spec from the config.
 + */
 +static inline void fetch_one_setup_partial(struct remote *remote)
 +{
 +      /*
 +       * Explicit --no-filter argument overrides everything, regardless
 +       * of any prior partial clones and fetches.
 +       */
 +      if (filter_options.no_filter)
 +              return;
 +
 +      /*
 +       * If no prior partial clone/fetch and the current fetch DID NOT
 +       * request a partial-fetch, do a normal fetch.
 +       */
 +      if (!repository_format_partial_clone && !filter_options.choice)
 +              return;
 +
 +      /*
 +       * If this is the FIRST partial-fetch request, we enable partial
 +       * on this repo and remember the given filter-spec as the default
 +       * for subsequent fetches to this remote.
 +       */
 +      if (!repository_format_partial_clone && filter_options.choice) {
 +              partial_clone_register(remote->name, &filter_options);
 +              return;
 +      }
 +
 +      /*
 +       * We are currently limited to only ONE promisor remote and only
 +       * allow partial-fetches from the promisor remote.
 +       */
 +      if (strcmp(remote->name, repository_format_partial_clone)) {
 +              if (filter_options.choice)
 +                      die(_("--filter can only be used with the remote configured in core.partialClone"));
 +              return;
 +      }
 +
 +      /*
 +       * Do a partial-fetch from the promisor remote using either the
 +       * explicitly given filter-spec or inherit the filter-spec from
 +       * the config.
 +       */
 +      if (!filter_options.choice)
 +              partial_clone_get_default_filter_spec(&filter_options);
 +      return;
 +}
 +
+ static int fetch_one(struct remote *remote, int argc, const char **argv, int prune_tags_ok)
  {
        static const char **refs = NULL;
        struct refspec *refspec;
  {
        int i;
        struct string_list list = STRING_LIST_INIT_DUP;
 -      struct remote *remote;
 +      struct remote *remote = NULL;
        int result = 0;
++      int prune_tags_ok = 1;
        struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
  
        packet_trace_identity("fetch");
                } else {
                        /* Zero or one remotes */
                        remote = remote_get(argv[0]);
 -                      result = fetch_one(remote, argc-1, argv+1, argc == 1);
++                      prune_tags_ok = (argc == 1);
 +                      argc--;
 +                      argv++;
                }
        }
  
-               result = fetch_one(remote, argc, argv);
 +      if (remote) {
 +              if (filter_options.choice || repository_format_partial_clone)
 +                      fetch_one_setup_partial(remote);
++              result = fetch_one(remote, argc, argv, prune_tags_ok);
 +      } else {
 +              if (filter_options.choice)
 +                      die(_("--filter can only be used with the remote configured in core.partialClone"));
 +              /* TODO should this also die if we have a previous partial-clone? */
 +              result = fetch_multiple(&list);
 +      }
 +
        if (!result && (recurse_submodules != RECURSE_SUBMODULES_OFF)) {
                struct argv_array options = ARGV_ARRAY_INIT;