summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 6dd82e5607..82b393ec31 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -3,6 +3,8 @@
#include "refs.h"
#include "pkt-line.h"
#include "sideband.h"
+#include "repository.h"
+#include "object-store.h"
#include "tag.h"
#include "object.h"
#include "commit.h"
@@ -311,7 +313,7 @@ static int got_oid(const char *hex, struct object_id *oid)
if (!has_object_file(oid))
return -1;
- o = parse_object(oid);
+ o = parse_object(the_repository, oid);
if (!o)
die("oops (%s)", oid_to_hex(oid));
if (o->type == OBJ_COMMIT) {
@@ -349,7 +351,7 @@ static int reachable(struct commit *want)
break;
}
if (!commit->object.parsed)
- parse_object(&commit->object.oid);
+ parse_object(the_repository, &commit->object.oid);
if (commit->object.flags & REACHABLE)
continue;
commit->object.flags |= REACHABLE;
@@ -379,7 +381,7 @@ static int ok_to_give_up(void)
if (want->flags & COMMON_KNOWN)
continue;
- want = deref_tag(want, "a want line", 0);
+ want = deref_tag(the_repository, want, "a want line", 0);
if (!want || want->type != OBJ_COMMIT) {
/* no way to tell if this is reachable by
* looking at the ancestry chain alone, so
@@ -569,7 +571,7 @@ static int get_reachable_list(struct object_array *src,
if (parse_oid_hex(namebuf, &sha1, &p) || *p != '\n')
break;
- o = lookup_object(sha1.hash);
+ o = lookup_object(the_repository, sha1.hash);
if (o && o->type == OBJ_COMMIT) {
o->flags &= ~TMP_MARK;
}
@@ -659,7 +661,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;
@@ -696,14 +698,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++) {
@@ -783,7 +785,8 @@ static int send_shallow_list(int depth, int deepen_rev_list,
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);
}
}
@@ -799,7 +802,7 @@ static int process_shallow(const char *line, struct object_array *shallows)
struct object *object;
if (get_oid_hex(arg, &oid))
die("invalid shallow line: %s", line);
- object = parse_object(&oid);
+ object = parse_object(the_repository, &oid);
if (!object)
return 1;
if (object->type != OBJ_COMMIT)
@@ -925,7 +928,7 @@ static void receive_needs(void)
if (allow_filter && parse_feature_request(features, "filter"))
filter_capability_requested = 1;
- o = parse_object(&oid_buf);
+ o = parse_object(the_repository, &oid_buf);
if (!o) {
packet_write_fmt(1,
"ERR upload-pack: not our ref %s",
@@ -1172,7 +1175,7 @@ static int parse_want(const char *line)
die("git upload-pack: protocol error, "
"expected to get oid, not '%s'", line);
- o = parse_object(&oid);
+ o = parse_object(the_repository, &oid);
if (!o) {
packet_write_fmt(1,
"ERR upload-pack: not our ref %s",
@@ -1314,7 +1317,7 @@ static int process_haves(struct oid_array *haves, struct oid_array *common)
oid_array_append(common, oid);
- o = parse_object(oid);
+ o = parse_object(the_repository, oid);
if (!o)
die("oops (%s)", oid_to_hex(oid));
if (o->type == OBJ_COMMIT) {
@@ -1411,14 +1414,15 @@ static void send_shallow_info(struct upload_pack_data *data)
{
/* No shallow info needs to be sent */
if (!data->depth && !data->deepen_rev_list && !data->shallows.nr &&
- !is_repository_shallow())
+ !is_repository_shallow(the_repository))
return;
packet_write_fmt(1, "shallow-info\n");
if (!send_shallow_list(data->depth, data->deepen_rev_list,
data->deepen_since, &data->deepen_not,
- &data->shallows) && is_repository_shallow())
+ &data->shallows) &&
+ is_repository_shallow(the_repository))
deepen(INFINITE_DEPTH, data->deepen_relative, &data->shallows);
packet_delim(1);