Last active
December 18, 2015 19:48
-
-
Save clemensg/5835253 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -daurp subversion-1.8.0/subversion/libsvn_subr/path.c subversion-1.8.0-newpatch/subversion/libsvn_subr/path.c | |
--- subversion-1.8.0/subversion/libsvn_subr/path.c 2013-05-14 00:40:07.000000000 +0200 | |
+++ subversion-1.8.0-newpatch/subversion/libsvn_subr/path.c 2013-07-02 23:39:04.000000000 +0200 | |
@@ -40,6 +40,10 @@ | |
#include "dirent_uri.h" | |
+#ifdef DARWIN | |
+#include <CoreFoundation/CoreFoundation.h> | |
+#endif | |
+ | |
/* The canonical empty path. Can this be changed? Well, change the empty | |
test below and the path library will work, not so sure about the fs/wc | |
@@ -1100,7 +1104,6 @@ svn_path_get_absolute(const char **pabso | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
/** Get APR's internal path encoding. */ | |
static svn_error_t * | |
get_path_encoding(svn_boolean_t *path_is_utf8, apr_pool_t *pool) | |
@@ -1119,7 +1122,6 @@ get_path_encoding(svn_boolean_t *path_is | |
*path_is_utf8 = (encoding_style == APR_FILEPATH_ENCODING_UTF8); | |
return SVN_NO_ERROR; | |
} | |
-#endif | |
svn_error_t * | |
@@ -1127,19 +1129,15 @@ svn_path_cstring_from_utf8(const char ** | |
const char *path_utf8, | |
apr_pool_t *pool) | |
{ | |
-#if !defined(WIN32) && !defined(DARWIN) | |
svn_boolean_t path_is_utf8; | |
SVN_ERR(get_path_encoding(&path_is_utf8, pool)); | |
if (path_is_utf8) | |
-#endif | |
{ | |
*path_apr = apr_pstrdup(pool, path_utf8); | |
return SVN_NO_ERROR; | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
else | |
return svn_utf_cstring_from_utf8(path_apr, path_utf8, pool); | |
-#endif | |
} | |
@@ -1148,16 +1146,24 @@ svn_path_cstring_to_utf8(const char **pa | |
const char *path_apr, | |
apr_pool_t *pool) | |
{ | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+#ifdef DARWIN | |
+ CFMutableStringRef cfmsr = CFStringCreateMutable(NULL, 0); | |
+ CFStringAppendCString(cfmsr, path_apr, kCFStringEncodingUTF8); | |
+ CFStringNormalize(cfmsr, kCFStringNormalizationFormC); | |
+ CFIndex path_buff_size = 1 + CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfmsr), kCFStringEncodingUTF8); | |
+ path_apr = apr_palloc(pool, path_buff_size); | |
+ CFStringGetCString(cfmsr, path_apr, path_buff_size, kCFStringEncodingUTF8); | |
+ CFRelease(cfmsr); | |
+ *path_utf8 = path_apr; | |
+ return SVN_NO_ERROR; | |
+#else | |
svn_boolean_t path_is_utf8; | |
SVN_ERR(get_path_encoding(&path_is_utf8, pool)); | |
if (path_is_utf8) | |
-#endif | |
{ | |
*path_utf8 = apr_pstrdup(pool, path_apr); | |
return SVN_NO_ERROR; | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
else | |
return svn_utf_cstring_to_utf8(path_utf8, path_apr, pool); | |
#endif | |
diff -daurp subversion-1.8.0/subversion/svn/proplist-cmd.c subversion-1.8.0-newpatch/subversion/svn/proplist-cmd.c | |
--- subversion-1.8.0/subversion/svn/proplist-cmd.c 2013-02-24 19:31:38.000000000 +0100 | |
+++ subversion-1.8.0-newpatch/subversion/svn/proplist-cmd.c 2013-07-02 23:39:54.000000000 +0200 | |
@@ -98,6 +98,11 @@ proplist_receiver_xml(void *baton, | |
else | |
name_local = path; | |
+#ifdef DARWIN | |
+ if(! is_url) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool)); | |
+#endif | |
+ | |
sb = NULL; | |
@@ -137,6 +142,11 @@ proplist_receiver(void *baton, | |
else | |
name_local = path; | |
+#ifdef DARWIN | |
+ if (! is_url) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool)); | |
+#endif | |
+ | |
if (inherited_props) | |
{ | |
int i; | |
diff -daurp subversion-1.8.0/subversion/svn/status-cmd.c subversion-1.8.0-newpatch/subversion/svn/status-cmd.c | |
--- subversion-1.8.0/subversion/svn/status-cmd.c 2013-03-23 16:44:36.000000000 +0100 | |
+++ subversion-1.8.0-newpatch/subversion/svn/status-cmd.c 2013-07-02 23:39:54.000000000 +0200 | |
@@ -111,6 +111,10 @@ print_start_target_xml(const char *targe | |
{ | |
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool); | |
+#ifdef DARWIN | |
+ SVN_ERR(svn_path_cstring_to_utf8(&target, target, pool)); | |
+#endif | |
+ | |
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target", | |
"path", target, NULL); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -daurp subversion/libsvn_subr/path.orig.c subversion/libsvn_subr/path.c | |
--- subversion/libsvn_subr/path.orig.c 2013-05-14 00:40:07.000000000 +0200 | |
+++ subversion/libsvn_subr/path.c 2013-06-22 01:58:05.000000000 +0200 | |
@@ -40,6 +40,9 @@ | |
#include "dirent_uri.h" | |
+#if defined(DARWIN) | |
+#include <CoreFoundation/CoreFoundation.h> | |
+#endif /* DARWIN */ | |
/* The canonical empty path. Can this be changed? Well, change the empty | |
test below and the path library will work, not so sure about the fs/wc | |
@@ -1100,7 +1103,6 @@ svn_path_get_absolute(const char **pabso | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
/** Get APR's internal path encoding. */ | |
static svn_error_t * | |
get_path_encoding(svn_boolean_t *path_is_utf8, apr_pool_t *pool) | |
@@ -1119,8 +1121,6 @@ get_path_encoding(svn_boolean_t *path_is | |
*path_is_utf8 = (encoding_style == APR_FILEPATH_ENCODING_UTF8); | |
return SVN_NO_ERROR; | |
} | |
-#endif | |
- | |
svn_error_t * | |
svn_path_cstring_from_utf8(const char **path_apr, | |
@@ -1148,18 +1148,38 @@ svn_path_cstring_to_utf8(const char **pa | |
const char *path_apr, | |
apr_pool_t *pool) | |
{ | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+#if defined(DARWIN) | |
+ /* | |
+ Special treatment for Mac OS X to support UTF-8 MAC encodings. | |
+ Convert any decomposed unicode characters into precomposed ones. | |
+ This will solve the problem that the 'svn status' command sometimes | |
+ cannot recognize the same file if it contains composed characters, | |
+ like Umlaut in some European languages. | |
+ */ | |
+ CFMutableStringRef cfmsr = CFStringCreateMutable(NULL, 0); | |
+ CFStringAppendCString(cfmsr, path_apr, kCFStringEncodingUTF8); | |
+ CFStringNormalize(cfmsr, kCFStringNormalizationFormC); | |
+ CFIndex path_buff_size = 1 + CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfmsr), kCFStringEncodingUTF8); | |
+ path_apr = apr_palloc(pool, path_buff_size); | |
+ CFStringGetCString(cfmsr, path_apr, path_buff_size, kCFStringEncodingUTF8); | |
+ CFRelease(cfmsr); | |
+ *path_utf8 = path_apr; | |
+ return SVN_NO_ERROR; | |
+#else | |
+ /* Use the default method on any other OS */ | |
+ #if !defined(WIN32) | |
svn_boolean_t path_is_utf8; | |
SVN_ERR(get_path_encoding(&path_is_utf8, pool)); | |
if (path_is_utf8) | |
-#endif | |
+ #endif | |
{ | |
*path_utf8 = apr_pstrdup(pool, path_apr); | |
return SVN_NO_ERROR; | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+ #if !defined(WIN32) | |
else | |
return svn_utf_cstring_to_utf8(path_utf8, path_apr, pool); | |
+ #endif | |
#endif | |
} | |
diff -daurp subversion/svn/proplist-cmd.orig.c subversion/svn/proplist-cmd.c | |
--- subversion/svn/proplist-cmd.orig.c 2013-02-24 19:31:38.000000000 +0100 | |
+++ subversion/svn/proplist-cmd.c 2013-06-22 01:55:34.000000000 +0200 | |
@@ -98,6 +98,11 @@ proplist_receiver_xml(void *baton, | |
else | |
name_local = path; | |
+#if defined(DARWIN) | |
+ if (! is_url) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool)); | |
+#endif | |
+ | |
sb = NULL; | |
@@ -137,6 +142,11 @@ proplist_receiver(void *baton, | |
else | |
name_local = path; | |
+#if defined(DARWIN) | |
+ if (! is_url) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool)); | |
+#endif | |
+ | |
if (inherited_props) | |
{ | |
int i; | |
diff -daurp subversion/svn/status-cmd.orig.c subversion/svn/status-cmd.c | |
--- subversion/svn/status-cmd.orig.c 2013-03-23 16:44:36.000000000 +0100 | |
+++ subversion/svn/status-cmd.c 2013-06-22 01:51:21.000000000 +0200 | |
@@ -111,6 +111,10 @@ print_start_target_xml(const char *targe | |
{ | |
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool); | |
+#if defined(DARWIN) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&target, target, pool)); | |
+#endif | |
+ | |
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target", | |
"path", target, NULL); | |
Clemens,
I patch my macports install of subversion
http://pastebin.com/6Yf8PaD8
But I still get errors when using filenames with extended characters (I'm working on get this included for macports - https://trac.macports.org/ticket/40508#comment:14 - too)
Any idea?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Clemens,
I'm coming from http://subversion.tigris.org/issues/show_bug.cgi?id=2464 and tried your patch on a fresh download of subversion-1.8.0 sources.
Unfortunately I got some errors applying the patch:
voodoo:Libraries erik$ patch -p0 < patch.diff
patching file subversion-1.8.0/subversion/libsvn_subr/path.c
Hunk #1 FAILED at 40.
Hunk #2 FAILED at 1104.
Hunk #3 FAILED at 1122.
Hunk #4 FAILED at 1129.
Hunk #5 FAILED at 1146.
5 out of 5 hunks FAILED -- saving rejects to file subversion-1.8.0/subversion/libsvn_subr/path.c.rej
patching file subversion-1.8.0/subversion/svn/proplist-cmd.c
Hunk #1 FAILED at 98.
Hunk #2 FAILED at 142.
2 out of 2 hunks FAILED -- saving rejects to file subversion-1.8.0/subversion/svn/proplist-cmd.c.rej
patching file subversion-1.8.0/subversion/svn/status-cmd.c
Hunk #1 FAILED at 111.
1 out of 1 hunk FAILED -- saving rejects to file subversion-1.8.0/subversion/svn/status-cmd.c.rej
Any hints for an unexperienced patcher?!
Best regards,
Erik