Commit bdba6f9c69ed12a05f539cda2155bae439a07a78
Wrap repos in pull-git-repo to access packed objects
Charles Lehner committed on 3/6/2016, 11:10:59 PMParent: cf3e042658b75b328309f0f7f47d952ea5d5fa72
Files changed
index.js | changed |
package.json | changed |
index.js | ||
---|---|---|
@@ -1,8 +1,9 @@ | ||
1 | 1 | var pull = require('pull-stream') |
2 | 2 | var cat = require('pull-cat') |
3 | 3 | var cache = require('pull-cache') |
4 | 4 | var buffered = require('pull-buffered') |
5 | +var Repo = require('pull-git-repo') | |
5 | 6 | var pack = require('pull-git-pack') |
6 | 7 | var pktLine = require('./lib/pkt-line') |
7 | 8 | var indexPack = require('./lib/index-pack') |
8 | 9 | var util = require('./lib/util') |
@@ -115,9 +116,9 @@ | ||
115 | 116 | cb(end) |
116 | 117 | else if (have.type != 'have') |
117 | 118 | cb(new Error('Unknown have' + JSON.stringify(have))) |
118 | 119 | else |
119 | - repo.hasObject(have.hash, function (err, haveIt) { | |
120 | + repo.hasObjectFromAny(have.hash, function (err, haveIt) { | |
120 | 121 | if (err) return cb(err) |
121 | 122 | if (!haveIt) |
122 | 123 | return readHave(null, next) |
123 | 124 | commonHash = haveIt |
@@ -203,9 +204,9 @@ | ||
203 | 204 | function addObject(hash, cb) { |
204 | 205 | if (ended) return cb(ended) |
205 | 206 | if (hash in objectsAdded || hash == commonHash) return cb() |
206 | 207 | objectsAdded[hash] = true |
207 | - repo.getObject(hash, function (err, object) { | |
208 | + repo.getObjectFromAny(hash, function (err, object) { | |
208 | 209 | if (err) return cb(err) |
209 | 210 | if (object.type == 'blob') { |
210 | 211 | objects.push(object) |
211 | 212 | cb() |
@@ -430,8 +431,10 @@ | ||
430 | 431 | verbosity: 1, |
431 | 432 | progress: false |
432 | 433 | } |
433 | 434 | |
435 | + repo = Repo(repo) | |
436 | + | |
434 | 437 | function handleConnect(cmd, read) { |
435 | 438 | var args = util.split2(cmd) |
436 | 439 | switch (args[0]) { |
437 | 440 | case 'git-upload-pack': |
Built with git-ssb-web