, through = require('through') , Buffer = require('buffer').Buffer , walk = require('git-walk-refs') , $ = require('jquery-browserify') , _ = require('lodash') , objectify = require('git-objectify-pack') // make a websocket connection to the // server. var conn = shoe('/git') , client // automatically clone plate. client = fetch( 'git://github.com/chrisdickinson/plate.git' , want ) // we get a callback for each ref. say `true` // if we want the ref, `false` if we don't. function want(ref, ready) { return ready(/(HEAD|heads)/.test(ref.name)) } function write(content) { content = '<pre>' + _.escape(content) + '</pre>' $('#content').append(content) } client .pipe(conn)
var gitclient = require('git-fetch-pack') , transport = require('git-transport-protocol') , unpack = require('git-list-pack') , concat = require('concat-stream') , objectify = require('git-objectify-pack') var tcp = net.connect({host: 'github.com', port: 9418}) , client function want(ref, ready) { return ready(/(master)/.test(ref.name)) } client = gitclient( 'git://github.com/chrisdickinson/plate.git' , want ) // pipe client to the transport and back to client. client .pipe(transport(tcp)) .pipe(client) // when we get packfile data, it'll come out of this // readable stream. var c = 0 , o = 0 , h = {} client.pack