Skip to content

Commit

Permalink
Fix git-p4 decode_path() missing an assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
SaNeOr committed Mar 2, 2024
1 parent 0f9d4d2 commit b1f8fe2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions git-p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ def metadata_stream_to_writable_bytes(s):
if encodingStrategy == 'passthrough':
return s
try:
s.decode('utf_8')
return s
return s.decode('utf_8')
except UnicodeDecodeError:
if encodingStrategy == 'fallback' and fallbackEncoding:
global encoding_fallback_warning_issued
Expand Down Expand Up @@ -304,10 +303,10 @@ def decode_path(path):

encoding = gitConfig('git-p4.pathEncoding') or 'utf_8'
if bytes is not str:
return path.decode(encoding, errors='replace') if isinstance(path, bytes) else path
path = path.decode(encoding, errors='replace') if isinstance(path, bytes) else path
else:
try:
path.decode('ascii')
path = path.decode('ascii')
except:
path = path.decode(encoding, errors='replace')
if verbose:
Expand Down Expand Up @@ -3114,7 +3113,7 @@ def writeToGitStream(self, gitMode, relPath, contents):

def encodeWithUTF8(self, path):
try:
path.decode('ascii')
path = path.decode('ascii')
except:
encoding = 'utf8'
if gitConfig('git-p4.pathEncoding'):
Expand Down

0 comments on commit b1f8fe2

Please sign in to comment.