Allow reading svn dumps from files via file:// urls
[gitweb.git] / vcs-svn / fast_export.c
index b823b8519c6dc76aa534e056c44eea7210e716f5..11f8f94b98a84e79f13bdb3cfbcab269dc2fc98f 100644 (file)
@@ -42,11 +42,6 @@ void fast_export_deinit(void)
                die_errno("error closing fast-import feedback stream");
 }
 
-void fast_export_reset(void)
-{
-       buffer_reset(&report_buffer);
-}
-
 void fast_export_delete(const char *path)
 {
        putchar('D');
@@ -77,7 +72,7 @@ static char gitsvnline[MAX_GITSVN_LINE_LEN];
 void fast_export_begin_commit(uint32_t revision, const char *author,
                        const struct strbuf *log,
                        const char *uuid, const char *url,
-                       unsigned long timestamp)
+                       unsigned long timestamp, const char *local_ref)
 {
        static const struct strbuf empty = STRBUF_INIT;
        if (!log)
@@ -89,7 +84,7 @@ void fast_export_begin_commit(uint32_t revision, const char *author,
        } else {
                *gitsvnline = '\0';
        }
-       printf("commit refs/heads/master\n");
+       printf("commit %s\n", local_ref);
        printf("mark :%"PRIu32"\n", revision);
        printf("committer %s <%s@%s> %ld +0000\n",
                   *author ? author : "nobody",
@@ -163,7 +158,7 @@ static int parse_cat_response_line(const char *header, off_t *len)
 
        if (ends_with(header, headerlen, " missing"))
                return error("cat-blob reports missing blob: %s", header);
-       type = memmem(header, headerlen, " blob ", strlen(" blob "));
+       type = strstr(header, " blob ");
        if (!type)
                return error("cat-blob header has wrong object type: %s", header);
        n = strtoumax(type + strlen(" blob "), (char **) &end, 10);
@@ -259,7 +254,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,
        }
 
        /* Mode. */
-       if (response_end - response < strlen("100644") ||
+       if (response_end - response < (signed) strlen("100644") ||
            response[strlen("100644")] != ' ')
                die("invalid ls response: missing mode: %s", response);
        *mode = 0;
@@ -272,7 +267,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,
        }
 
        /* ' blob ' or ' tree ' */
-       if (response_end - response < strlen(" blob ") ||
+       if (response_end - response < (signed) strlen(" blob ") ||
            (response[1] != 'b' && response[1] != 't'))
                die("unexpected ls response: not a tree or blob: %s", response);
        response += strlen(" blob ");