summaryrefslogtreecommitdiff
path: root/send-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/send-pack.c b/send-pack.c
index d2d2a49..a8cc6b2 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "config.h"
#include "commit.h"
#include "refs.h"
#include "pkt-line.h"
@@ -50,7 +51,7 @@ static void feed_object(const unsigned char *sha1, FILE *fh, int negative)
/*
* Make a pack stream and spit it out into file descriptor fd
*/
-static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, struct send_pack_args *args)
+static int pack_objects(int fd, struct ref *refs, struct oid_array *extra, struct send_pack_args *args)
{
/*
* The child becomes pack-objects --revs; we feed
@@ -98,7 +99,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
*/
po_in = xfdopen(po.in, "w");
for (i = 0; i < extra->nr; i++)
- feed_object(extra->sha1[i], po_in, 1);
+ feed_object(extra->oid[i].hash, po_in, 1);
while (refs) {
if (!is_null_oid(&refs->old_oid))
@@ -132,7 +133,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
* For a normal non-zero exit, we assume pack-objects wrote
* something useful to stderr. For death by signal, though,
* we should mention it to the user. The exception is SIGPIPE
- * (141), because that's a normal occurence if the remote end
+ * (141), because that's a normal occurrence if the remote end
* hangs up (and we'll report that by trying to read the unpack
* status).
*/
@@ -376,7 +377,7 @@ static void reject_invalid_nonce(const char *nonce, int len)
int send_pack(struct send_pack_args *args,
int fd[], struct child_process *conn,
struct ref *remote_refs,
- struct sha1_array *extra_have)
+ struct oid_array *extra_have)
{
int in = fd[0];
int out = fd[1];
@@ -491,9 +492,12 @@ int send_pack(struct send_pack_args *args,
* we were to send it and we're trying to send the refs
* atomically, abort the whole operation.
*/
- if (use_atomic)
+ if (use_atomic) {
+ strbuf_release(&req_buf);
+ strbuf_release(&cap_buf);
return atomic_push_failure(args, remote_refs, ref);
- /* Fallthrough for non atomic case. */
+ }
+ /* else fallthrough */
default:
continue;
}
@@ -532,6 +536,14 @@ int send_pack(struct send_pack_args *args,
}
}
+ if (use_push_options) {
+ struct string_list_item *item;
+
+ packet_buf_flush(&req_buf);
+ for_each_string_list_item(item, args->push_options)
+ packet_buf_write(&req_buf, "%s", item->string);
+ }
+
if (args->stateless_rpc) {
if (!args->dry_run && (cmds_sent || is_repository_shallow())) {
packet_buf_flush(&req_buf);
@@ -544,18 +556,6 @@ int send_pack(struct send_pack_args *args,
strbuf_release(&req_buf);
strbuf_release(&cap_buf);
- if (use_push_options) {
- struct string_list_item *item;
- struct strbuf sb = STRBUF_INIT;
-
- for_each_string_list_item(item, args->push_options)
- packet_buf_write(&sb, "%s", item->string);
-
- write_or_die(out, sb.buf, sb.len);
- packet_flush(out);
- strbuf_release(&sb);
- }
-
if (use_sideband && cmds_sent) {
memset(&demux, 0, sizeof(demux));
demux.proc = sideband_demux;