[Kde-scm-interest] svn2git: file is svn:special but not a symlink

Niko Sams niko.sams at gmail.com
Sun Sep 26 19:45:36 CEST 2010


please review this fix:
diff --git a/src/svn.cpp b/src/svn.cpp
index dd3ce53..7511326 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -285,11 +285,17 @@ static int dumpBlob(Repository::Transaction
*txn, svn_fs_root_t *fs_root,
             QByteArray buf;
             buf.reserve(len);
             SVN_ERR(svn_stream_read(in_stream, buf.data(), &len));
-            if (len != strlen("link ") || strncmp(buf, "link ", len) != 0)
-                qFatal("file %s is svn:special but not a symlink", pathname);
+            if (len == strlen("link ") && strncmp(buf, "link ", len) == 0) {
+                mode = 0120000;
+                stream_length -= len;
+            } else {
+                //this can happen if a link changed into a file in one commit
+                qWarning("file %s is svn:special but not a symlink", pathname);
+                // re-open the file as we tried to read "link "
+                svn_stream_close(in_stream);
+                SVN_ERR(svn_fs_file_contents(&in_stream, fs_root,
pathname, dumppool));
+            }
         }
-        mode = 0120000;
-        stream_length -= len;
     }

     QIODevice *io = txn->addFile(finalPathName, mode, stream_length);



I tried creating a test repository with such a commit, but failed as
svn didn't allow such a commit.
Maybe older versions allowed that.

Niko


More information about the Kde-scm-interest mailing list