commit: convert register_commit_graft to handle arbitrary repositories
[gitweb.git] / upload-pack.c
index f51b6cfca9435d6b3b3f5b44b593a7c5cd2b1d3e..51b9038111e7f7b2f54443fa613c1cd0b2bfb457 100644 (file)
@@ -3,6 +3,7 @@
 #include "refs.h"
 #include "pkt-line.h"
 #include "sideband.h"
+#include "object-store.h"
 #include "tag.h"
 #include "object.h"
 #include "commit.h"
@@ -69,7 +70,7 @@ static int stateless_rpc;
 static const char *pack_objects_hook;
 
 static int filter_capability_requested;
-static int filter_advertise;
+static int allow_filter;
 static struct list_objects_filter_options filter_options;
 
 static void reset_timeout(void)
@@ -662,7 +663,7 @@ static void send_shallow(struct commit_list *result)
                if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
                        packet_write_fmt(1, "shallow %s",
                                         oid_to_hex(&object->oid));
-                       register_shallow(&object->oid);
+                       register_shallow(the_repository, &object->oid);
                        shallow_nr++;
                }
                result = result->next;
@@ -699,14 +700,14 @@ static void send_unshallow(const struct object_array *shallows)
                        add_object_array(object, NULL, &extra_edge_obj);
                }
                /* make sure commit traversal conforms to client */
-               register_shallow(&object->oid);
+               register_shallow(the_repository, &object->oid);
        }
 }
 
 static void deepen(int depth, int deepen_relative,
                   struct object_array *shallows)
 {
-       if (depth == INFINITE_DEPTH && !is_repository_shallow()) {
+       if (depth == INFINITE_DEPTH && !is_repository_shallow(the_repository)) {
                int i;
 
                for (i = 0; i < shallows->nr; i++) {
@@ -846,7 +847,7 @@ static void receive_needs(void)
                        no_progress = 1;
                if (parse_feature_request(features, "include-tag"))
                        use_include_tag = 1;
-               if (parse_feature_request(features, "filter"))
+               if (allow_filter && parse_feature_request(features, "filter"))
                        filter_capability_requested = 1;
 
                o = parse_object(&oid_buf);
@@ -911,7 +912,8 @@ static void receive_needs(void)
                if (shallows.nr > 0) {
                        int i;
                        for (i = 0; i < shallows.nr; i++)
-                               register_shallow(&shallows.objects[i].item->oid);
+                               register_shallow(the_repository,
+                                                &shallows.objects[i].item->oid);
                }
 
        shallow_nr += shallows.nr;
@@ -976,7 +978,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
                                     " allow-reachable-sha1-in-want" : "",
                             stateless_rpc ? " no-done" : "",
                             symref_info.buf,
-                            filter_advertise ? " filter" : "",
+                            allow_filter ? " filter" : "",
                             git_user_agent_sanitized());
                strbuf_release(&symref_info);
        } else {
@@ -1056,7 +1058,7 @@ static int upload_pack_config(const char *var, const char *value, void *unused)
                if (!strcmp("uploadpack.packobjectshook", var))
                        return git_config_string(&pack_objects_hook, var, value);
        } else if (!strcmp("uploadpack.allowfilter", var)) {
-               filter_advertise = git_config_bool(var, value);
+               allow_filter = git_config_bool(var, value);
        }
        return parse_hide_refs_config(var, value, "uploadpack");
 }