summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 7498b45e2e..26f29b85b5 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -10,7 +10,7 @@
#include "pkt-line.h"
#include "sideband.h"
#include "repository.h"
-#include "object-store-ll.h"
+#include "object-store.h"
#include "oid-array.h"
#include "object.h"
#include "commit.h"
@@ -509,8 +509,7 @@ static int got_oid(struct upload_pack_data *data,
{
if (get_oid_hex(hex, oid))
die("git upload-pack: expected SHA1 object, got '%s'", hex);
- if (!repo_has_object_file_with_flags(the_repository, oid,
- OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
+ if (!has_object(the_repository, oid, 0))
return -1;
return do_got_oid(data, oid);
}
@@ -665,8 +664,8 @@ static int do_reachable_revlist(struct child_process *cmd,
cmd_in = xfdopen(cmd->in, "w");
- for (i = get_max_object_index(); 0 < i; ) {
- o = get_indexed_object(--i);
+ for (i = get_max_object_index(the_repository); 0 < i; ) {
+ o = get_indexed_object(the_repository, --i);
if (!o)
continue;
if (reachable && o->type == OBJ_COMMIT)
@@ -734,8 +733,8 @@ static int get_reachable_list(struct upload_pack_data *data,
o->flags &= ~TMP_MARK;
}
}
- for (i = get_max_object_index(); 0 < i; i--) {
- o = get_indexed_object(i - 1);
+ for (i = get_max_object_index(the_repository); 0 < i; i--) {
+ o = get_indexed_object(the_repository, i - 1);
if (o && o->type == OBJ_COMMIT &&
(o->flags & TMP_MARK)) {
add_object_array(o, NULL, reachable);
@@ -1449,7 +1448,7 @@ void upload_pack(const int advertise_refs, const int stateless_rpc,
for_each_namespaced_ref_1(send_ref, &data);
if (!data.sent_capabilities) {
const char *refname = "capabilities^{}";
- write_v0_ref(&data, refname, refname, null_oid());
+ write_v0_ref(&data, refname, refname, null_oid(the_hash_algo));
}
/*
* fflush stdout before calling advertise_shallow_grafts because send_ref
@@ -1557,7 +1556,7 @@ static int parse_want_ref(struct packet_writer *writer, const char *line,
}
if (!o)
- o = parse_object_or_die(&oid, refname_nons);
+ o = parse_object_or_die(the_repository, &oid, refname_nons);
if (!(o->flags & WANTED)) {
o->flags |= WANTED;
@@ -1781,27 +1780,27 @@ static void send_shallow_info(struct upload_pack_data *data)
packet_delim(1);
}
-enum fetch_state {
- FETCH_PROCESS_ARGS = 0,
- FETCH_SEND_ACKS,
- FETCH_SEND_PACK,
- FETCH_DONE,
+enum upload_state {
+ UPLOAD_PROCESS_ARGS = 0,
+ UPLOAD_SEND_ACKS,
+ UPLOAD_SEND_PACK,
+ UPLOAD_DONE,
};
int upload_pack_v2(struct repository *r, struct packet_reader *request)
{
- enum fetch_state state = FETCH_PROCESS_ARGS;
+ enum upload_state state = UPLOAD_PROCESS_ARGS;
struct upload_pack_data data;
- clear_object_flags(ALL_FLAGS);
+ clear_object_flags(the_repository, ALL_FLAGS);
upload_pack_data_init(&data);
data.use_sideband = LARGE_PACKET_MAX;
get_upload_pack_config(r, &data);
- while (state != FETCH_DONE) {
+ while (state != UPLOAD_DONE) {
switch (state) {
- case FETCH_PROCESS_ARGS:
+ case UPLOAD_PROCESS_ARGS:
process_args(request, &data);
if (!data.want_obj.nr && !data.wait_for_done) {
@@ -1812,27 +1811,27 @@ int upload_pack_v2(struct repository *r, struct packet_reader *request)
* to just send 'have's without 'want's); guess
* they didn't want anything.
*/
- state = FETCH_DONE;
+ state = UPLOAD_DONE;
} else if (data.seen_haves) {
/*
* Request had 'have' lines, so lets ACK them.
*/
- state = FETCH_SEND_ACKS;
+ state = UPLOAD_SEND_ACKS;
} else {
/*
* Request had 'want's but no 'have's so we can
* immediately go to construct and send a pack.
*/
- state = FETCH_SEND_PACK;
+ state = UPLOAD_SEND_PACK;
}
break;
- case FETCH_SEND_ACKS:
+ case UPLOAD_SEND_ACKS:
if (process_haves_and_send_acks(&data))
- state = FETCH_SEND_PACK;
+ state = UPLOAD_SEND_PACK;
else
- state = FETCH_DONE;
+ state = UPLOAD_DONE;
break;
- case FETCH_SEND_PACK:
+ case UPLOAD_SEND_PACK:
send_wanted_ref_info(&data);
send_shallow_info(&data);
@@ -1842,9 +1841,9 @@ int upload_pack_v2(struct repository *r, struct packet_reader *request)
packet_writer_write(&data.writer, "packfile\n");
create_pack_file(&data, NULL);
}
- state = FETCH_DONE;
+ state = UPLOAD_DONE;
break;
- case FETCH_DONE:
+ case UPLOAD_DONE:
continue;
}
}