Stash/git/dulwich and binaries
I can include binary files like images in my Github repo using the web interface. But if I try to push the same file in stash/git, I get a broken pipe error until I rm the file from the staging area.
Do others have the same issue? Any way around it?
Have you tried using ssh to push? For whatever reason, zi have found it more reliable, but slower. I usually set up origin as the https url, and originssh as the ssh url, the can use
git push originsshwhen things go south.
Another thing that can help is to do a fetch/merge before pushing, as sometimes github won't let you push if your branch is not a direct descendant of the one on github.
Do you have a specific file that you can reproduce this with, in a blank repo? If so, I can take a look... the problem for me has always been figuring out a way to reproduce it, so we can flag the issue in dulwich.
@JonB, thanks. Unfortunately I am too git-incompetent to know how to set originssh. I am using https urls throughout.
Steps to recreate the issue:
- Create a new repository in github, with a README file.
- Create a local directory and clone the new repository.
- Modify README file and push - successful.
- Create a new text file and push - successful.
- Add a smallish binary file in the root directory and push - successful.
- Add a larger binary file and push - fails with the error below.
stash: <class 'urllib2.URLError'>: <urlopen error [Errno 32] Broken pipe>
After this failure, the only way I have been able to resume normal git client use is to remove .git and clone again from remote.
Above using the latest selfupdated version of stash:
StaSh v0.6.18 Pythonista 3.1 (301016) iOS 10.3.2 (64-bit iPhone8,2) root: ~/Documents/site-packages/stash stash.py: 2017-04-19 11:36:33 SELFUPDATE_BRANCH: master BIN_PATH: ~/Documents/bin ~/Documents/stash_extensions/bin ~/Documents/site-packages/stash/bin
very intersting - i was able to reproduce with these files, so that helps. I will play around with dulwich to see if this is reproduced with plain dulwich, then can open an issue against dulwich.
Did you try with an ssh url, and did it make any difference?
I don't have Pythonista anymore, so I can't exactly reproduce your issue. But to my understanding, StaSh runs on Python 2. The way 2 and 3 handles networking interfaces is a little different, mainly because Python 3 uses
bytesobjects instead of normal strings for most networking tasks (like the
requestsmodule). So maybe that's part of your problem: the way it's handling your binary?
The study of requests source code reveals and impressive array of high quality "complexity hiding" techniques. One of the most visible end user manifestations of this is the .text and .content attributes and .json() method of a requests.get() for instance. They return the results of the get() as Unicode, bytes, and json respectively. They do this flawless despite the fact that Python 2 and 3 have different notions of Unicode and bytes/strings. This complexity hiding helps users deliver a lot of functionality in little code.
@JonB, did you get any results from plain dulwich? I do not have a "plain" Python setup, but can start looking into it if you are otherwise occupied.
I think i did, but was getting a minimum repeatable failure... I have been on travel so have not gotten back to it...