expose a helper function peel_to_type().
[gitweb.git] / http-push.c
index c221dce62c16254c40c8c2a1f2d18dc3b55f20d9..63ff218b3c2a9d006ec95f20e7c1cd3a0808dffa 100644 (file)
@@ -2169,6 +2169,7 @@ int main(int argc, char **argv)
        int i;
        int new_refs;
        struct ref *ref;
+       char *rewritten_url = NULL;
 
        setup_git_directory();
 
@@ -2236,6 +2237,14 @@ int main(int argc, char **argv)
 
        no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
 
+       if (remote->url && remote->url[strlen(remote->url)-1] != '/') {
+               rewritten_url = malloc(strlen(remote->url)+2);
+               strcpy(rewritten_url, remote->url);
+               strcat(rewritten_url, "/");
+               remote->url = rewritten_url;
+               ++remote->path_len;
+       }
+
        /* Verify DAV compliance/lock support */
        if (!locking_available()) {
                rc = 1;
@@ -2374,7 +2383,8 @@ int main(int argc, char **argv)
 
                /* Generate a list of objects that need to be pushed */
                pushing = 0;
-               prepare_revision_walk(&revs);
+               if (prepare_revision_walk(&revs))
+                       die("revision walk setup failed");
                mark_edges_uninteresting(revs.commits);
                objects_to_send = get_delta(&revs, ref_lock);
                finish_all_active_slots();
@@ -2416,6 +2426,8 @@ int main(int argc, char **argv)
        }
 
  cleanup:
+       if (rewritten_url)
+               free(rewritten_url);
        if (info_ref_lock)
                unlock_remote(info_ref_lock);
        free(remote);