Skip to content

Commit

Permalink
Previously the following would crash under Python 3.
Browse files Browse the repository at this point in the history
    $ python examples/clone.py . /tmp/clone
  • Loading branch information
myint authored and jelmer committed Nov 3, 2015
1 parent 334be7f commit b90cad1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dulwich/porcelain.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
GitStatus = namedtuple('GitStatus', 'staged unstaged untracked')


default_bytes_out_stream = getattr(sys.stdout, 'buffer', sys.stdout)
default_bytes_err_stream = getattr(sys.stderr, 'buffer', sys.stderr)


def encode_path(path):
"""Encode a path as bytestring."""
# TODO(jelmer): Use something other than ascii?
Expand Down Expand Up @@ -216,7 +220,7 @@ def init(path=".", bare=False):
return Repo.init(path)


def clone(source, target=None, bare=False, checkout=None, errstream=sys.stdout, outstream=None):
def clone(source, target=None, bare=False, checkout=None, errstream=default_bytes_err_stream, outstream=None):
"""Clone a local or remote git repository.
:param source: Path or URL for source repository
Expand Down

0 comments on commit b90cad1

Please sign in to comment.