threads / patch / 40392

v3git-p4: use replacement character for non UTF-8 characters in paths

Subject: [PATCH v3] git-p4: use replacement character for non UTF-8 characters in paths

## tl;dr

4 messages between Sep 21, 2015 and Sep 21, 2015. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

larsxschneider@gmail.com· Sep 21, 2015, 08:49 UTC · lore
From: Lars Schneider <larsxschneider@gmail.com>

I broke a test in "[PATCH v2] git-p4: improve path encoding verbose output" on the next branch. This patch on top of next (3dd15c0) fixes the issue.

Thanks to Luke for finding the issue!

Cheers, Lars

Lars Schneider (1):
  git-p4: use replacement character for non UTF-8 characters in paths
 git-p4.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 2.5.1

larsxschneider@gmail.com· Sep 21, 2015, 08:49 UTC · re: larsxschneider@gmail.com · lore
From: Lars Schneider <larsxschneider@gmail.com>

If non UTF-8 characters are detected in paths then replace them with � instead of throwing a UnicodeDecodeError exception. This restores the original (implicit) implementation that was broken in 00a9403.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
 git-p4.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to git-p4.py +1 −1
diff --git a/git-p4.py b/git-p4.py
index e7510a9..215f556 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2226,7 +2226,7 @@ class P4Sync(Command, P4UserMap):
             encoding = 'utf8'
             if gitConfig('git-p4.pathEncoding'):
                 encoding = gitConfig('git-p4.pathEncoding')
-            relPath = relPath.decode(encoding).encode('utf8', 'replace')
+            relPath = relPath.decode(encoding, 'replace').encode('utf8', 'replace')
             if self.verbose:
                 print 'Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, relPath)
 
-- 
2.5.1
Luke Diamand· Sep 21, 2015, 19:34 UTC · re: larsxschneider@gmail.com · lore

Re: [PATCH v3] git-p4: use replacement character for non UTF-8 characters in paths

On 21/09/15 09:49, larsxschneider@gmail.com wrote:
Show 6 quoted lines
> From: Lars Schneider <larsxschneider@gmail.com>
>
> I broke a test in "[PATCH v2] git-p4: improve path encoding verbose output" on the next branch.
> This patch on top of next (3dd15c0) fixes the issue.
>
> Thanks to Luke for finding the issue!

Looks good to me, apart from using a UTF-8 char in the comment itself, which seems a bit unnecessary. Imagine what will happen to someone using git-p4 to mirror git-p4 itself into p4!

Show 13 quoted lines
>
> Cheers,
> Lars
>
> Lars Schneider (1):
>    git-p4: use replacement character for non UTF-8 characters in paths
>
>   git-p4.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> --
> 2.5.1
>
Junio C Hamano· Sep 21, 2015, 20:23 UTC · re: Luke Diamand · lore

Re: [PATCH v3] git-p4: use replacement character for non UTF-8 characters in paths

Luke Diamand <luke@diamand.org> writes:
Show 12 quoted lines
> On 21/09/15 09:49, larsxschneider@gmail.com wrote:
>> From: Lars Schneider <larsxschneider@gmail.com>
>>
>> I broke a test in "[PATCH v2] git-p4: improve path encoding verbose
>> output" on the next branch.
>> This patch on top of next (3dd15c0) fixes the issue.
>>
>> Thanks to Luke for finding the issue!
>
> Looks good to me, apart from using a UTF-8 char in the comment itself,
> which seems a bit unnecessary. Imagine what will happen to someone
> using git-p4 to mirror git-p4 itself into p4!
;-)  Thanks.
Show 15 quoted lines
>
>
>>
>> Cheers,
>> Lars
>>
>> Lars Schneider (1):
>>    git-p4: use replacement character for non UTF-8 characters in paths
>>
>>   git-p4.py | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> --
>> 2.5.1
>>

← back to recent threads