4 ms·
I'm a bit intrigued. As the main developer of a Git library[1] myself (in pure PHP, not depending on the git binary or esoteric extensions), I have no doubt t
by drrotmos 14y ago
I'm a bit intrigued. As the main developer of a Git library[1] myself (in pure PHP, not depending on the git binary or esoteric extensions), I have no doubt that the actual parsing of the git objects and packfiles will be very much possible to achieve in a browser environment.
[1]: https://github.com/e-butik/Gittern/ https://github.com/e-butik/Gittern/
However, there are technical considerations. For example, pack files can get pretty large (indeed version 2 packfiles supports files > 4 GB), and I doubt browsers are optimized for random access to large files (so you wouldn't have to load the entire file in memory). Another potential problem would be pushing and pulling. The dumb HTTP transport is obviously possible to use (but rarely supported anymore), and the smart HTTP transport should be able to get working, but for implementing the git protocol, or git+ssh you'd need regular sockets, which AFAIK browsers don't provide.
I do however wish the author the best of luck with this project, and since I see that he's here, I will leave with links to a few resources I found useful:
* http://git-scm.com/book/en/Git-Internals http://git-scm.com/book/en/Git-Internals
* http://opensource.apple.com/source/Git/Git-26/src/git-htmldocs/technical/index-format.txt http://opensource.apple.com/source/Git/Git-26/src/git-htmldo...
* http://www.opensource.apple.com/source/Git/Git-17/src/git-htmldocs/technical/pack-format.txt http://www.opensource.apple.com/source/Git/Git-17/src/git-ht...
* http://git.rsbx.net/Documents/Git_Data_Formats.txt http://git.rsbx.net/Documents/Git_Data_Formats.txt
- creationix 14y agoThanks for the links. You are correct that I probably won't be able to support all git repos because of memory constraints and unless I get special APIs from the browser I won't be able to do git protocol or git over ssh. I do feel pretty confident that I can implement dumb and smart HTTP though. Even if this library can't be used for everything, it will allow a whole lot more use cases that are currently possible.
- maksimlin 14y agoI'd say smart http is more than enough, especially since Github for example is pushing it as the preferred protocol for most users: https://github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage https://github.com/blog/1104-credential-caching-for-wrist-fr... The main issue is that Github do not have CORS support for http access to repos (though they do support CORS for access to repos via their proprietary API) and I don't think the other big public hosters like Bitbucket or Google Code support CORS either. On the subject of big pack files, sure you'd want to stream them to storage instead of trying to store in memory (for instance JGit has this as an option) but I agree Tim that to start with, even supporting small-medium size repos would be a huge win.
- tmzt 14y agoAny idea what is going on with the progressive Git protocol, I know there was some discussion on the git devel lists but I'm having trouble finding it. (Essentially it's a protocol based on fast-import to allow access a remote repository without cloning or receiving a pack.) Also, there are proxies for converting TCP into websocket that should work with the Git protocol, and at least Chrome has some kind of native TCP socket from extensions.