Browse Source

Support byte filenames in GitFile.

Jelmer Vernooij 7 years ago
parent
commit
b89bedc514
1 changed files with 4 additions and 1 deletions
  1. 4 1
      dulwich/file.py

+ 4 - 1
dulwich/file.py

@@ -118,7 +118,10 @@ class _GitFile(object):
 
 
     def __init__(self, filename, mode, bufsize):
     def __init__(self, filename, mode, bufsize):
         self._filename = filename
         self._filename = filename
-        self._lockfilename = '%s.lock' % self._filename
+        if isinstance(self._filename, bytes):
+            self._lockfilename = self._filename + b'.lock'
+        else:
+            self._lockfilename = self._filename + '.lock'
         try:
         try:
             fd = os.open(
             fd = os.open(
                 self._lockfilename,
                 self._lockfilename,