summaryrefslogtreecommitdiff
path: root/http-push.c
diff options
context:
space:
mode:
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/http-push.c b/http-push.c
index 7dcd9da..7e38522 100644
--- a/http-push.c
+++ b/http-push.c
@@ -6,12 +6,13 @@
#include "refs.h"
#include "diff.h"
#include "revision.h"
-#include "exec_cmd.h"
+#include "exec-cmd.h"
#include "remote.h"
#include "list-objects.h"
#include "sigchain.h"
#include "argv-array.h"
#include "packfile.h"
+#include "object-store.h"
#ifdef EXPAT_NEEDS_XMLPARSE_H
#include <xmlparse.h>
@@ -361,7 +362,7 @@ static void start_put(struct transfer_request *request)
ssize_t size;
git_zstream stream;
- unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
+ unpacked = read_object_file(&request->obj->oid, &type, &len);
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
/* Set it up */
@@ -1330,7 +1331,7 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock)
int count = 0;
while ((commit = get_revision(revs)) != NULL) {
- p = process_tree(commit->tree, p);
+ p = process_tree(get_commit_tree(commit), p);
commit->object.flags |= LOCAL;
if (!(commit->object.flags & UNINTERESTING))
count += add_send_request(&commit->object, lock);
@@ -1691,8 +1692,7 @@ int cmd_main(int argc, const char **argv)
{
struct transfer_request *request;
struct transfer_request *next_request;
- int nr_refspec = 0;
- const char **refspec = NULL;
+ struct refspec rs = REFSPEC_INIT_PUSH;
struct remote_lock *ref_lock = NULL;
struct remote_lock *info_ref_lock = NULL;
struct rev_info revs;
@@ -1755,8 +1755,7 @@ int cmd_main(int argc, const char **argv)
}
continue;
}
- refspec = argv;
- nr_refspec = argc - i;
+ refspec_appendn(&rs, argv, argc - i);
break;
}
@@ -1767,7 +1766,7 @@ int cmd_main(int argc, const char **argv)
if (!repo->url)
usage(http_push_usage);
- if (delete_branch && nr_refspec != 1)
+ if (delete_branch && rs.nr != 1)
die("You must specify only one branch name when deleting a remote branch");
setup_git_directory();
@@ -1813,18 +1812,18 @@ int cmd_main(int argc, const char **argv)
/* Remove a remote branch if -d or -D was specified */
if (delete_branch) {
- if (delete_remote_branch(refspec[0], force_delete) == -1) {
+ const char *branch = rs.items[i].src;
+ if (delete_remote_branch(branch, force_delete) == -1) {
fprintf(stderr, "Unable to delete remote branch %s\n",
- refspec[0]);
+ branch);
if (helper_status)
- printf("error %s cannot remove\n", refspec[0]);
+ printf("error %s cannot remove\n", branch);
}
goto cleanup;
}
/* match them up */
- if (match_push_refs(local_refs, &remote_refs,
- nr_refspec, (const char **) refspec, push_all)) {
+ if (match_push_refs(local_refs, &remote_refs, &rs, push_all)) {
rc = -1;
goto cleanup;
}