Code

Merge branch 'jk/maint-push-over-dav' into maint
[git.git] / transport.c
index 57138d908a5749d378af441e8d3cfe8150b27271..c2245d4f0d59d35cf0ae77fad25d80697a3901e6 100644 (file)
@@ -502,7 +502,7 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus
        struct ref *refs;
 
        connect_setup(transport, for_push, 0);
-       get_remote_heads(data->fd[0], &refs, 0, NULL,
+       get_remote_heads(data->fd[0], &refs,
                         for_push ? REF_NORMAL : 0, &data->extra_have);
        data->got_remote_heads = 1;
 
@@ -537,7 +537,7 @@ static int fetch_refs_via_pack(struct transport *transport,
 
        if (!data->got_remote_heads) {
                connect_setup(transport, 0, 0);
-               get_remote_heads(data->fd[0], &refs_tmp, 0, NULL, 0, NULL);
+               get_remote_heads(data->fd[0], &refs_tmp, 0, NULL);
                data->got_remote_heads = 1;
        }
 
@@ -772,8 +772,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
                struct ref *tmp_refs;
                connect_setup(transport, 1, 0);
 
-               get_remote_heads(data->fd[0], &tmp_refs, 0, NULL, REF_NORMAL,
-                                NULL);
+               get_remote_heads(data->fd[0], &tmp_refs, REF_NORMAL, NULL);
                data->got_remote_heads = 1;
        }
 
@@ -859,28 +858,6 @@ static int is_local(const char *url)
                has_dos_drive_prefix(url);
 }
 
-static int is_gitfile(const char *url)
-{
-       struct stat st;
-       char buf[9];
-       int fd, len;
-       if (stat(url, &st))
-               return 0;
-       if (!S_ISREG(st.st_mode))
-               return 0;
-       if (st.st_size < 10 || st.st_size > 9 + PATH_MAX)
-               return 0;
-
-       fd = open(url, O_RDONLY);
-       if (fd < 0)
-               die_errno("Error opening '%s'", url);
-       len = read_in_full(fd, buf, sizeof(buf));
-       close(fd);
-       if (len != sizeof(buf))
-               die("Error reading %s", url);
-       return !prefixcmp(buf, "gitdir: ");
-}
-
 static int is_file(const char *url)
 {
        struct stat buf;
@@ -929,7 +906,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
                ret->fetch = fetch_objs_via_rsync;
                ret->push = rsync_transport_push;
                ret->smart_options = NULL;
-       } else if (is_local(url) && is_file(url) && !is_gitfile(url)) {
+       } else if (is_local(url) && is_file(url) && is_bundle(url, 1)) {
                struct bundle_transport_data *data = xcalloc(1, sizeof(*data));
                ret->data = data;
                ret->get_refs_list = get_refs_from_bundle;
@@ -1048,8 +1025,8 @@ int transport_push(struct transport *transport,
                if (flags & TRANSPORT_PUSH_MIRROR)
                        match_flags |= MATCH_REFS_MIRROR;
 
-               if (match_refs(local_refs, &remote_refs,
-                              refspec_nr, refspec, match_flags)) {
+               if (match_push_refs(local_refs, &remote_refs,
+                                   refspec_nr, refspec, match_flags)) {
                        return -1;
                }