[PATCH] Fix: applying a patch with file deletions results in these files are missing

Denis Kovalchuk via TortoiseSVN-dev <[email protected]>
Newsgroups gmane.comp.version-control.subversion.tortoisesvn.devel
Message-ID <[email protected]>
Hello.

Steps to reproduce:
1. Create a patch that deletes files.
2. Apply the patch using TortoiseSVN.
3. Use "svn status" to check your working copy state.
4. See that the files are missing, not deleted.

The problem is reproduced in at least TortoiseSVN 1.13 and 1.14.

It looks like a copy-paste typo in r28529 [1]: svn_*dirent*_canonicalize() 
calls
have been replaced with svn_*uri*_canonicalize_safe() instead of
svn_*dirent*_canonicalize_safe(). As a result, the SVNPatch::RemoveFile()
function fails. It also seems that the SVNPatch::PatchPath() function is
affected by the same problem.

There is a patch with a fix in attachments.

[1] 
https://osdn.net/projects/tortoisesvn/scm/svn/commits/28529#fd-trunk/src/SVN/SVNPatch.cpp

With best regards,
Denis Kovalchuk

-- 
You received this message because you are subscribed to the Google Groups "TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/tortoisesvn-dev/c298e0f0-d17b-4bf8-946c-8677e90b3e66n%40googlegroups.com.
fix-apply-patch-deleted-files-are-missing.patch.txt (text/plain, 1.7 KB)
Follow-up to r28529: Use correct functions to canonicalize paths. At least this
fixes the following problem: applying a patch with file deletions results in
these files are missing.

Index: src/SVN/SVNPatch.cpp
===================================================================
--- src/SVN/SVNPatch.cpp	(revision 29343)
+++ src/SVN/SVNPatch.cpp	(working copy)
@@ -317,7 +317,7 @@
     svn_error_clear(svn_client_create_context2(&ctx, SVNConfig::Instance().GetConfig(m_pool), scratchPool));
 
     const char* patchAbspath = nullptr;
-    err                      = svn_uri_canonicalize_safe(&patchAbspath, nullptr,
+    err                      = svn_dirent_canonicalize_safe(&patchAbspath, nullptr,
                                     CUnicodeUtils::GetUTF8(m_patchFile),
                                     scratchPool, scratchPool);
     if (err)
@@ -329,7 +329,7 @@
     }
 
     const char* localAbspath = nullptr;
-    err                      = svn_uri_canonicalize_safe(&localAbspath, nullptr,
+    err                      = svn_dirent_canonicalize_safe(&localAbspath, nullptr,
                                     CUnicodeUtils::GetUTF8(m_targetPath),
                                     scratchPool, scratchPool);
     if (err)
@@ -587,7 +587,7 @@
     apr_array_header_t* targets = apr_array_make(scratchPool, 1, sizeof(const char*));
 
     const char* canonicalizedPath = nullptr;
-    svn_error_clear(svn_uri_canonicalize_safe(&canonicalizedPath, nullptr, CUnicodeUtils::GetUTF8(path), scratchPool, scratchPool));
+    svn_error_clear(svn_dirent_canonicalize_safe(&canonicalizedPath, nullptr, CUnicodeUtils::GetUTF8(path), scratchPool, scratchPool));
     if (canonicalizedPath == nullptr)
     {
         apr_pool_destroy(scratchPool);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.