diff options
| author | Scott Prager <splinterofchaos@gmail.com> | 2015-06-06 16:17:35 -0400 |
|---|---|---|
| committer | Scott Prager <splinterofchaos@gmail.com> | 2015-06-06 19:00:15 -0400 |
| commit | 25bcaeaa0c66cdb9219517dc479444f4d7938c83 (patch) | |
| tree | 0171d1334128b8e77403321610de7e0437c6556d /git-remote-gittorrent | |
| parent | ff2e993343f689312a51c1bbbf620c05e41a4f62 (diff) | |
gittorrentd: Use git-upload-pack for pack files.
Add `upload_pack` to the git module to (partially) implement the pack protocol,
then use this in gittorrentd instead of `git pack-objects`. This lets us
generate packs based off HEAD instead of packing the whole tree each time.
Diffstat (limited to 'git-remote-gittorrent')
| -rwxr-xr-x | git-remote-gittorrent | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/git-remote-gittorrent b/git-remote-gittorrent index ad9825b..bb76dc8 100755 --- a/git-remote-gittorrent +++ b/git-remote-gittorrent @@ -125,13 +125,6 @@ dht.on('peer', function (addr, hash, from) { goal.swarm.addPeer(addr) }) -function update_ref (sha) { - fetching[sha].branches.forEach(function (branch) { - branch = remotename + '/' + branch - spawn('git', ['update-ref', branch, sha]) - }) -} - function get_infohash (sha, branch) { branch = branch.replace(/^refs\/(heads\/)?/, '') branch = branch.replace(/\/head$/, '') @@ -170,8 +163,10 @@ function get_infohash (sha, branch) { tracker: false }) client.download(infoHash, function (torrent) { - console.warn('Downloading git pack with infohash: ' + chalk.green(infoHash) + '\n') + console.warn('Downloading ' + chalk.green(torrent.files[0].path) + + ' with infohash: ' + chalk.green(infoHash) + '\n') torrent.on('done', function (done) { + console.warn('done downloading: ' + chalk.green(torrent.files[0].path)) fetching[sha].got = true var stream = torrent.files[0].createReadStream() @@ -179,7 +174,6 @@ function get_infohash (sha, branch) { stream.pipe(unpack.stdin) unpack.stderr.pipe(process.stderr) unpack.on('exit', function (code) { - update_ref(sha) todo-- if (todo <= 0) { // These writes are actually necessary for git to finish |
