Repository navigation
Description
apologies if you guys have already discussed this. @chrisdickinson has been working on a js git implementation lately:
https://github.com/chrisdickinson/git-fetch-pack
https://github.com/chrisdickinson/git-walk-tree
https://github.com/chrisdickinson/git-odb
https://github.com/chrisdickinson/git-odb-pack
https://github.com/chrisdickinson/git-packfile
https://github.com/chrisdickinson/git-walk-refs
https://github.com/chrisdickinson/git-parse-human
https://github.com/chrisdickinson/git-transport-protocol
https://github.com/chrisdickinson/git-read-pkt-line
https://github.com/chrisdickinson/git-write-pkt-line
https://github.com/chrisdickinson/git-load-refs
https://github.com/chrisdickinson/git-packidx-parser
https://github.com/chrisdickinson/git-packed-ref-parse
https://github.com/chrisdickinson/git-to-js
https://github.com/chrisdickinson/git-object-tree
https://github.com/chrisdickinson/git-object-tag
https://github.com/chrisdickinson/git-object-commit
https://github.com/chrisdickinson/git-object-blob
https://github.com/chrisdickinson/git-odb-loose
https://github.com/chrisdickinson/git-autoregister-odb
https://github.com/chrisdickinson/git-apply-delta
etc
Activity
chrisdickinson commentedon Mar 31, 2013
current working theory:
this also implies:
.git/indexfiles; at least not necessarily in the same way that filesystem-backed git does.what does this leave out?
ofsandrefdeltas off the bat; the packing heuristics are kind of poorly documented.what are weaknesses of the browserify approach?
zlibshim only includesinflateSync, which means that we'll have to make use of the"browser"field in package.json's to use inflate/deflate. And those shims should certainly seek to use web workers where possible, to lower the chance of a "this tab timed out" notification while generating/parsing packfiles.what are weaknesses in node that make this hard?
my plan for the near future:
git-packfileto read objects.git-smart-http-remoterepo that works withgit-fetch-pack.maks commentedon Mar 31, 2013
@chrisdickinson that's really great work.
working theory points 2 & 3 I whole heartedly agree with, there is no point using c-git filesystem dir structure for object or metadata storage in browser. But then there's the practical need to actual be able to checkout a working direcvtory which does require something resembling a typical file system.
Likewise agree with not needing to use existing index file format, especially given its a binary format that's not especially well documented, but will need to have something similar to allow for staging commits, the index does serve that rather core purpose of preparing what will become the next commits tree and diff'ing current working dir against it.
for testing against smart http remotes from a browser, pushover seems a great fit, as it's simple to add CORS support by putting a reverse proxy in front of it or maybe just adding it directly to pushover itself.
max-mapper commentedon Mar 31, 2013
fs-browserify could be useful here, it implements a few of the most common fs operations on top of indexeddb
Sent from my iPhone
On Mar 31, 2013, at 4:25 AM, Maksim Lin [email protected] wrote:
chrisdickinson commentedon Mar 31, 2013
@maks yep, the idea is that the "local checkout" package will be entirely separate from the other packages -- you'll populate it using git-walk-tree.
basically, you should be able to use any "local checkout" package that supports being piped to from walk-tree; whether that's backed by plain JS objects, indexeddb, localstorage, requestFileSystem, etc, etc.
The other bonus point here is that by making the utility functions agnostic of the ODB being used (and the filesystem), you could actually back this with redis (or some other KV store) on the server.
creationix commentedon Apr 1, 2013
I wonder how much value there is in having interop at the level of the actual files in the
.gitfolder. I know several people showed interest in using js-git server-side to replace shelling out to git for various deployment situations.Also I'm not sure that leaning on browserify is such a good idea if it's shims will make it hard to take full advantage of the native APIs in the browser. I guess it will just depend on what the tradeoffs end up being.
Unfortunately I won't be able to start coding on this for a couple more weeks. I do hope that I'll be able to take advantage of a lot of @chrisdickinson's great work.
kuba-kubula commentedon Apr 1, 2013
For zip and other packaging, what about emscripten / asm.js conversion of zlib? see: https://github.com/richardassar/zpipe
or the whole list of compiled into JS libs at https://github.com/kripken/emscripten/wiki
chrisdickinson commentedon Apr 1, 2013
@creationix Agreed on there not being a huge amount of value for interop at the filesystem level; at best it provides us with test data to feed into the other packages. It shouldn't be the focus (though really, at this point it's 90% done -- both pack and loose odbs are implemented and while it's currently readonly, it's really simple to create loose pack objects).
re: browserify's shims:
zlibis probably the most problematic -- though that can be shimmed for something likezpipeusing browserify's"browser": {"./file.js": "shim-file.js"}package.json directive. Really, the primary problem with most of the zlib implementations I've found is that they don't differentiate data returned withZ_STREAM_ENDfrom data returned withZ_OK; I've been banging my head against this for the last week or so. Ideally, we'll support node (so you can run a git server entirely in JS), so this'll have to get solved sooner rather than later. Dan Lucraft'sgit.jsgot around this by including a slightly modified version ofraw-deflate.js(the zlib implementation that's been floating around the internet, unlicensed, since 1998) that counts the number of compressed bytes involved in generating output.In practice, the buffer shim isn't a huge problem -- it can be mostly solved by converting to typed arrays either on-the-fly (which is what I've been doing thus far) using
new Uint8Array(buffer.parent).subarray(buffer.offset, buffer.offset + buffer.length)and keeping a map of buffer parents to uint8array instances around (to offset the cost of creating uint8arrays) or at entry / exit points (harder, since this implies that every stream will have to be reworked to accept only uint8arrays and have to be piped through a conversion stream. Really, browserify buys us a lot more than it costs us -- especially with the--standalonegeneration option.@kuba-kubula thanks for the link! I recently found (like, last night) that imaya's inflate implementation might not be able to inflate certain decompressed streams (namely, those with predefined dictionaries) so I might try plugging in zpipe instead.
If all goes well (and I'm optimistic -- I just got the
git-pack-unpackstream 90% working last night; it emits offsets of objects within a packfile so we can generate an index / pull them out and put those objects in a more browser-sane object db), I should have some sort of demo by the end of the coming weekend.chrisdickinson commentedon Apr 1, 2013
also, in re: the zlib shim not being ideal -- it's fairly easy to swap it out for other implementations using browserify.
the harder part is node: its builtin implementation is problematic WRT actually figuring out how many compressed bytes it takes to generate a payload of a given size ):
chrisdickinson commentedon Apr 1, 2013
ahaha, ignore me! browserify's zlib deals just fine with the data, I was just feeding it bad data. So, imaya's zlib should work.
@kuba-kubula looked into zpipe. Sadly, it probably won't work for our purposes:
0xFFFDwhich loses the original data the characters represented)).chrisdickinson commentedon Apr 2, 2013
this will pull down packfiles and emit unparsed objects and offsets
juliangruber commentedon Apr 2, 2013
@chrisdickinson you are purely awesome!
chrisdickinson commentedon Apr 25, 2013
okay, so the inflate implementation is "fast enough" for now -- there are a couple of places where it could be sped up, but it doesn't take an hour to clone "mature" repos now. I've wired it up locally using levelidb for storage.
Next steps:
git-walk-treemodule so that it can check the type of an object before recursing into it (to avoid loading all of the blobs at once).git-receive-packandgit-send-packsimilar to howgit-fetch-packworks.creationix commentedon Apr 25, 2013
I'm travelling all day today (It's Thursday morning in France) I'll be
getting home late tonight in Texas (Thursday night). Tomorrow morning I
start full-time on js-git. Thanks for the pointers. Also, what should go
in this repo? Should this be the ceramic that consumes the many tiny
modules or something?
On Thu, Apr 25, 2013 at 7:39 AM, Chris Dickinson
[email protected]:
chrisdickinson commentedon Apr 25, 2013
@creationix Cool. Welcome back! So, ideally, this repo would provide the following: the project site itself plus possibly a dev blog (as a gh-pages branch), the documentation (which should cover the constituent libraries and give those curious an idea of how it all hangs together), and a porcelain library which should provide similar functionality to the
gitcommands after loading a repo.Super ideally, but totally up to you:
maks commentedon Apr 25, 2013
pretty much agree with @chrisdickinson about a porcelain level library and documentation and "reference" implemenation. Especially for the in-browser use case, I'd imagine that people (such as me) would want to use it directly within a text editor/IDE webapp due to sandboxing, rather than as some sort of stand-alone app like you would on a desktop/mobile os.
With different ODBs, @chrisdickinson doesn't your https://github.com/chrisdickinson/git-odb already provide a nice pluggable means of having multiple backends?
creationix commentedon May 10, 2013
Since we've been working together for the last week and a half and already depend on some of @chrisdickinson's repos, I'm going to close this issue. See new issues for specific tasks.