summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-05 17:59:22 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-05 17:59:22 +0100
commite1060a2a8c90c0730c3541811df8f906dac510a7 (patch)
tree1c29ef00a756be7e88aeb43cfa847dbf2e6f3079 /git/repo/base.py
parent8a308613467a1510f8dac514624abae4e10c0779 (diff)
downloadgitpython-e1060a2a8c90c0730c3541811df8f906dac510a7.tar.gz
test_commit works once again
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index f92a85ce..27c640ff 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -47,7 +47,10 @@ from .fun import (
read_gitfile,
touch,
)
-from git.compat import text_type
+from git.compat import (
+ text_type,
+ defenc
+)
import os
import sys
@@ -177,11 +180,11 @@ class Repo(object):
# Description property
def _get_description(self):
filename = join(self.git_dir, 'description')
- return open(filename).read().rstrip()
+ return open(filename, 'rb').read().rstrip().decode(defenc)
def _set_description(self, descr):
filename = join(self.git_dir, 'description')
- open(filename, 'w').write(descr + '\n')
+ open(filename, 'wb').write((descr + '\n').encode(defenc))
description = property(_get_description, _set_description,
doc="the project's description")
@@ -464,8 +467,8 @@ class Repo(object):
if os.path.exists(alternates_path):
try:
- f = open(alternates_path)
- alts = f.read()
+ f = open(alternates_path, 'rb')
+ alts = f.read().decode(defenc)
finally:
f.close()
return alts.strip().splitlines()
@@ -489,8 +492,8 @@ class Repo(object):
os.remove(alternates_path)
else:
try:
- f = open(alternates_path, 'w')
- f.write("\n".join(alts))
+ f = open(alternates_path, 'wb')
+ f.write("\n".join(alts).encode(defenc))
finally:
f.close()
# END file handling