t7000-t7999: fix broken &&-chains
[gitweb.git] / fetch-pack.c
index 490c38f833419cde65b97f75f454a7d148fff6a2..cc7a42fee9fad161e37caacf87a15b2c1e33ec94 100644 (file)
@@ -657,11 +657,11 @@ static void filter_refs(struct fetch_pack_args *args,
                                }
                                i++;
                        }
-               }
 
-               if (!keep && args->fetch_all &&
-                   (!args->deepen || !starts_with(ref->name, "refs/tags/")))
-                       keep = 1;
+                       if (!keep && args->fetch_all &&
+                           (!args->deepen || !starts_with(ref->name, "refs/tags/")))
+                               keep = 1;
+               }
 
                if (keep) {
                        *newtail = ref;
@@ -1198,14 +1198,29 @@ static int send_fetch_request(int fd_out, const struct fetch_pack_args *args,
        else if (is_repository_shallow() || args->deepen)
                die(_("Server does not support shallow requests"));
 
+       /* Add filter */
+       if (server_supports_feature("fetch", "filter", 0) &&
+           args->filter_options.choice) {
+               print_verbose(args, _("Server supports filter"));
+               packet_buf_write(&req_buf, "filter %s",
+                                args->filter_options.filter_spec);
+       } else if (args->filter_options.choice) {
+               warning("filtering not recognized by server, ignoring");
+       }
+
        /* add wants */
        add_wants(wants, &req_buf);
 
-       /* Add all of the common commits we've found in previous rounds */
-       add_common(&req_buf, common);
+       if (args->no_dependents) {
+               packet_buf_write(&req_buf, "done");
+               ret = 1;
+       } else {
+               /* Add all of the common commits we've found in previous rounds */
+               add_common(&req_buf, common);
 
-       /* Add initial haves */
-       ret = add_haves(&req_buf, haves_to_send, in_vain);
+               /* Add initial haves */
+               ret = add_haves(&req_buf, haves_to_send, in_vain);
+       }
 
        /* Send request */
        packet_buf_flush(&req_buf);