-
-
Notifications
You must be signed in to change notification settings - Fork 933
Raising of GitCommandError fails in archive function if stdout was a cStringIO object #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Using the latest version of GitPython (39335e6) on OSX on python 2.7, I was unable to reproduce the issue. Please feel free to provide more information to help reproducing it - maybe this functionality is platform dependent. In the meanwhile, I am closing this issue. |
Try it with a path filter using a path that not exists in the repo. e.g.
Using: python 2.7 On Ubuntu 16.04.2 LTS |
The error is the same using the version you tested (39335e6) |
Ping |
I tried to reproduce it again, and in python2.6 I get other errors than in python 3. In any case it does not work at least when done interactively. There are a few tests which obviously don't fail, but they don't try it on a path filter that yields no files. |
I'm having a similar issue. It seems that this bug is generic and affects all git commands: calling any git command that returns error while
On my machine (Python 2.7.14, Linux, GitPython 2.1.10) this script produces the following output:
https://github.com/gitpython-developers/GitPython/blob/master/git/cmd.py#L797 |
@the-owl Thanks for your input! It looks like your code-example is perfect for a small unit-test due it it being perfectly isolated. The parameter docs clearly state that a file-like object is expected, and the example above should work. |
This fixes gitpython-developers#619 - raise GitCommandError(not TypeError) when output_stream is set in git.execute
This fixes gitpython-developers#619 - raise GitCommandError(not TypeError) when output_stream is set in git.execute
I tried to check out an archive for a not existing path from the repository and I expect a GitCommandError exception.
I got following TypeError exception:
"Expected bytes or text, but got <cStringIO.StringO object at 0x7fabac6f97a0>"
I did following:
fpt = StringIO()
-- (used as a temporary storage for the tar archive)
self._repository.archive(fpt, treeish=version_identifier, format="tar", path=sub_path)
-- (where sub_path points to an not existing path)
The cause of the problem was, the Constructor of the GitCommandError could not handle the cStringIO object. (a normal file pointer may be faulty too).
I suppose it should set its stdout variable to None in case of not handled types. Or it should be adjusted when raising the exception.
The text was updated successfully, but these errors were encountered: