symbolic ref: refuse non-ref targets in HEAD
[gitweb.git] / http-push.c
index a4b7d08663504a57008f66a39fffe293f62c1d08..6ad853e2d01b4ee3b3ee282b30b8b7f374ae3d47 100644 (file)
@@ -1201,7 +1201,8 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
        /* Make sure leading directories exist for the remote ref */
        ep = strchr(url + strlen(remote->url) + 1, '/');
        while (ep) {
-               *ep = 0;
+               char saved_character = ep[1];
+               ep[1] = '\0';
                slot = get_active_slot();
                slot->results = &results;
                curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
@@ -1223,7 +1224,7 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
                        free(url);
                        return NULL;
                }
-               *ep = '/';
+               ep[1] = saved_character;
                ep = strchr(ep + 1, '/');
        }
 
@@ -1434,10 +1435,8 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
                        }
                        if (path) {
                                path += remote->path_len;
+                               ls->dentry_name = xstrdup(path);
                        }
-                       ls->dentry_name = xmalloc(strlen(path) -
-                                                 remote->path_len + 1);
-                       strcpy(ls->dentry_name, path + remote->path_len);
                } else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {
                        ls->dentry_flags |= IS_DIR;
                }
@@ -1448,6 +1447,12 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
        }
 }
 
+/*
+ * NEEDSWORK: remote_ls() ignores info/refs on the remote side.  But it
+ * should _only_ heed the information from that file, instead of trying to
+ * determine the refs from the remote file system (badly: it does not even
+ * know about packed-refs).
+ */
 static void remote_ls(const char *path, int flags,
                      void (*userFunc)(struct remote_ls_ctx *ls),
                      void *userData)