index.jsView |
---|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | | -function uploadPack(read, getObjects, refSource, wantSink, options) { |
| 66 | +function uploadPack(read, haveObject, getObjects, refSource, wantSink, options) { |
67 | 67 | |
68 | 68 | * include-tag multi_ack_detailed symref=HEAD:refs/heads/master |
69 | 69 | * agent=git/2.7.0 */ |
70 | 70 | var sendRefs = receivePackHeader([ |
76 | 76 | var commonHash |
77 | 77 | var sendPack |
78 | 78 | var earlyDisconnect |
79 | 79 | |
80 | | - function haveObject(hash, cb) { |
81 | | - cb() |
82 | | - |
83 | | - } |
84 | | - |
85 | 80 | |
86 | 81 | return cat([ |
87 | 82 | packLineEncode(cat([ |
88 | 83 | sendRefs, |
253 | 248 | }) |
254 | 249 | } |
255 | 250 | } |
256 | 251 | |
257 | | - |
258 | | - function readWant(abort, cb) { |
259 | | - readPackLine(abort, function (end, line) { |
260 | | - if (end) return cb(end) |
261 | | - if (options.verbosity >= 2) |
262 | | - console.error('line', line.toString('ascii')) |
263 | | - if (!line.length || line == 'done') { |
264 | | - console.error('WANTS done', line, line.length) |
265 | | - return cb(true) |
266 | | - } |
267 | | - var args = split3(line.toString('ascii')) |
268 | | - var caps = args[2] |
269 | | - if (caps && options.verbosity >= 2) |
270 | | - console.error('want capabilities:', caps) |
271 | | - cb(null, { |
272 | | - type: args[0], |
273 | | - hash: args[1].replace(/\n$/, ''), |
274 | | - }) |
275 | | - }) |
276 | | - } |
277 | | - */ |
278 | | - |
279 | 252 | b.packLines = readPackLine |
280 | 253 | b.updates = readUpdate |
281 | 254 | b.wants = b.haves = havesWants |
282 | 255 | |
378 | 351 | |
379 | 352 | module.exports = function (opts) { |
380 | 353 | var ended |
381 | 354 | var objectSink = opts.objectSink |
| 355 | + var haveObject = opts.haveObject || function (hash, cb) { cb(false) } |
382 | 356 | var getObjects = opts.getObjects || function (id, cb) { |
383 | 357 | cb(null, 0, pull.empty()) |
384 | 358 | } |
385 | 359 | var refSource = opts.refSource || pull.empty() |
394 | 368 | function handleConnect(cmd, read) { |
395 | 369 | var args = split2(cmd) |
396 | 370 | switch (args[0]) { |
397 | 371 | case 'git-upload-pack': |
398 | | - return prepend('\n', uploadPack(read, getObjects, refSource, |
| 372 | + return prepend('\n', uploadPack(read, haveObject, getObjects, refSource, |
399 | 373 | wantSink, options)) |
400 | 374 | case 'git-receive-pack': |
401 | 375 | return prepend('\n', receivePack(read, objectSink, refSource, |
402 | 376 | refSink, options)) |