merge-recursive.c: fix case-changing merge bug
[gitweb.git] / vcs-svn / fast_export.c
index df51c59ca5415387d593b5a726de9fcb1bffd7dc..bd0f2c2b86847708e5ebe668773f0fd08b9efc5d 100644 (file)
@@ -68,13 +68,19 @@ void fast_export_modify(const char *path, uint32_t mode, const char *dataref)
 }
 
 void fast_export_begin_note(uint32_t revision, const char *author,
-               const char *log, unsigned long timestamp)
+               const char *log, unsigned long timestamp, const char *note_ref)
 {
+       static int firstnote = 1;
        size_t loglen = strlen(log);
-       printf("commit refs/notes/svn/revs\n");
+       printf("commit %s\n", note_ref);
        printf("committer %s <%s@%s> %ld +0000\n", author, author, "local", timestamp);
        printf("data %"PRIuMAX"\n", (uintmax_t)loglen);
        fwrite(log, loglen, 1, stdout);
+       if (firstnote) {
+               if (revision > 1)
+                       printf("from %s^0", note_ref);
+               firstnote = 0;
+       }
        fputc('\n', stdout);
 }
 
@@ -156,22 +162,13 @@ static void die_short_read(struct line_buffer *input)
        die("invalid dump: unexpected end of file");
 }
 
-static int ends_with(const char *s, size_t len, const char *suffix)
-{
-       const size_t suffixlen = strlen(suffix);
-       if (len < suffixlen)
-               return 0;
-       return !memcmp(s + len - suffixlen, suffix, suffixlen);
-}
-
 static int parse_cat_response_line(const char *header, off_t *len)
 {
-       size_t headerlen = strlen(header);
        uintmax_t n;
        const char *type;
        const char *end;
 
-       if (ends_with(header, headerlen, " missing"))
+       if (ends_with(header, " missing"))
                return error("cat-blob reports missing blob: %s", header);
        type = strstr(header, " blob ");
        if (!type)