"""
from dulwich.errors import NotGitRepository
from dulwich.repo import Repo
+ # Repo currently expects a "str", so decode if necessary.
+ # TODO(jelmer): Perhaps move this into Repo() ?
+ if not isinstance(path, str):
+ path = path.decode(sys.getfilesystemencoding())
try:
repo = Repo(path)
except NotGitRepository:
save new blobs in
:return: An index entry
"""
+ assert isinstance(path, bytes)
try:
st = os.lstat(path)
blob = blob_from_path_and_stat(path, st)
except EnvironmentError as e:
if e.errno == errno.EISDIR:
- if os.path.exists(os.path.join(path, '.git')):
+ if os.path.exists(os.path.join(path, b'.git')):
head = read_submodule_head(path)
if head is None:
return None