Skip to content

Commit 8942284

Browse files
committed
index: Fixed bug which caused incorrect separators in output files of the return value
remote: fixed evil bug that was caused by some inconsistency of python when __getattr__ and __slots__ are invovled - namely it calles getattr before checking for a slot of the same name, in an alternating fashion
1 parent 3d93100 commit 8942284

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lib/git/index/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,14 +1021,14 @@ def handle_stderr(proc, iter_checked_out_files):
10211021
checked_out_files = list()
10221022

10231023
for path in paths:
1024-
path = self._to_relative_path(path)
1024+
co_path = to_native_path_linux(self._to_relative_path(path))
10251025
# if the item is not in the index, it could be a directory
10261026
path_is_directory = False
10271027

10281028
try:
1029-
self.entries[(path, 0)]
1029+
self.entries[(co_path, 0)]
10301030
except KeyError:
1031-
dir = path
1031+
dir = co_path
10321032
if not dir.endswith('/'):
10331033
dir += '/'
10341034
for entry in self.entries.itervalues():
@@ -1043,9 +1043,9 @@ def handle_stderr(proc, iter_checked_out_files):
10431043
# END path exception handlnig
10441044

10451045
if not path_is_directory:
1046-
self._write_path_to_stdin(proc, path, path, make_exc,
1046+
self._write_path_to_stdin(proc, co_path, path, make_exc,
10471047
fprogress, read_from_stdout=False)
1048-
checked_out_files.append(path)
1048+
checked_out_files.append(co_path)
10491049
# END path is a file
10501050
# END for each path
10511051
self._flush_stdin_and_wait(proc, ignore_stdout=True)

lib/git/remote.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from exc import GitCommandError
99
from objects import Commit
10+
from ConfigParser import NoOptionError
1011

1112
from git.util import (
1213
LazyMixin,
@@ -435,7 +436,13 @@ def __getattr__(self, attr):
435436
if attr == "_config_reader":
436437
return super(Remote, self).__getattr__(attr)
437438

438-
return self._config_reader.get(attr)
439+
# sometimes, probably due to a bug in python itself, we are being called
440+
# even though a slot of the same name exists
441+
try:
442+
return self._config_reader.get(attr)
443+
except NoOptionError:
444+
return super(Remote, self).__getattr__(attr)
445+
# END handle exception
439446

440447
def _config_section_name(self):
441448
return 'remote "%s"' % self.name

0 commit comments

Comments
 (0)