-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Hacks to build with emscripten for running in a web browser #4400
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
Conversation
Fixed a CI failure caused by my additions ( failed on including emscripten.h ). Travis CI now fails at same test as the latest PR submitted (#4677) so I guess that failure has nothing to do with the emscripten stuff. Also merged so that my branch is in sync with upstream master. |
So I am excited about this, but, of course, we can't just comment out code willy-nilly to work in emscripten. What is your plan here, @petersalomonsen? Is this branch aimed at just getting things working, then refactoring and tidying up later? Or should the core contributors be providing feedback into how we would like to see things organized? |
@ethomson Thanks for response. Would be very happy to get feedback about how you would like to see things organized. Since last feedback from you the tls stream for emscripten is separated out in the I think we're past the "getting things to work part", it works very well as far as I can tell. So now it's more about organizing it properly so that it can be a part of the official libgit2 repository. |
Cool, that was the impression that I got! I'll try to spend some time on this 🔜 |
@petersalomonsen Git protocol version v2 was recently introduced: https://github.com/git/git/blob/master/Documentation/technical/protocol-v2.txt If you had glanced at it, do you think it changes anything wrt need of CORS proxy to communicate with GitHub during in-browser cloning? Probably still not, right? |
@vadimkantorov Seems like for github a proxy will still be needed. As for my own use case I've made a git hosting solution using JGit which has http server support, and then I can of course set the CORS headers to what I want. |
@petersalomonsen js filters in your last commit sounds very interesting! Would you have an example of how to use them? As in function sig: what params the js filter would take, what it should return? |
@maks below is my filter function implemented in Javascript for replacing staged content with a git LFS style pointer. The last line is for registering the filter with libgit2. The What I'm trying to do is to handle when users are adding large binary files to the git repository, and store a pointer (inspired by Git LFS) instead of the actual content. With my git server I'm also going to implement a storage for the actual content. Trying to implement this using filters, just like LFS does.
|
bf03a17
to
dea0a8d
Compare
A successful LFS commit from the web-browser: fintechneo/browsergittestdata@8e181f3 A simple client implementation of LFS is in this project here: https://github.com/fintechneo/angular-git-filebrowser#large-files-using-git-lfs |
3045d91
to
a7328e0
Compare
Added emscripten to the build pipelines: https://dev.azure.com/libgit2/libgit2/_build/results?buildId=1171&view=logs Sources of the docker image used for the build / test is here: https://github.com/fintechneo/libgit2/tree/master/emscripten_hacks/docker |
c5c75c8
to
3265937
Compare
Some updates to this pull request today:
We should be closer to something that could be merged now, or what do you think @ethomson ? |
Todays update added a https transport for nodejs, and a few more additions to the js example library ( reset hard, last error, choose file_favor on pull). |
259b360
to
f88b96a
Compare
Rebased on latest origin master as of 2019-06-25. Some fixes to the nodejs version, and have successfully used it in an AWS lambda function. Binaries can be found here: https://www.npmjs.com/package/libgit2.js changed to using https://hub.docker.com/r/trzeci/emscripten/ for building in azure pipeline, and can also be used if you don't want to install emscripten. |
ce852dc
to
699c824
Compare
Removed "ugly" patching of file permissions because of use of the sticky bit, which isn't handled by emscripten. Instead patching the permissions function of emscripten to grant permission if the sticky bit is set: https://github.com/libgit2/libgit2/pull/4400/files#diff-38a5347ca2d81378f5963b6bb1d36c45R33 Also rebased on latest upstream master. |
Introducing new build option:
APPLY_EMSCRIPTEN_HACKS
which will apply necessary tweaks to run in a web browser. Also added emscripten_hacks folder with build script (build.sh) and instructions in README.md.