Merge branch 'km/doc-workflows-typofix'
[gitweb.git] / http-push.c
index 14435ab65d1bbe3fc73be6a6d774b6ab6ffc8360..7e38522098bf91c144adaee7f9f5476f8bc72cd2 100644 (file)
@@ -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,8 +362,8 @@ static void start_put(struct transfer_request *request)
        ssize_t size;
        git_zstream stream;
 
-       unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
-       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+       unpacked = read_object_file(&request->obj->oid, &type, &len);
+       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
 
        /* Set it up */
        git_deflate_init(&stream, zlib_compression_level);
@@ -915,6 +916,10 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
                                lock->timeout = -1;
                        }
                        XML_ParserFree(parser);
+               } else {
+                       fprintf(stderr,
+                               "error: curl result=%d, HTTP code=%ld\n",
+                               results.curl_result, results.http_code);
                }
        } else {
                fprintf(stderr, "Unable to start LOCK request\n");
@@ -1326,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);
@@ -1687,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;
@@ -1751,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;
        }
 
@@ -1763,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();
@@ -1809,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;
        }