Commit 907ec2fc5b45d1e87305436e74c01c7e455a29ef
Handle optional onEnd and opts arguments in pack
Charles Lehner committed on 2/26/2016, 10:53:51 PMParent: 1a425fdfb01339affe3481c9edff4453555b9f4d
Files changed
lib/pack.js | changed |
lib/pack.js | ||
---|---|---|
@@ -97,8 +97,11 @@ | ||
97 | 97 | |
98 | 98 | function decodePack(opts, repo, onEnd, read) { |
99 | 99 | if (read === undefined) |
100 | 100 | return decodePack.bind(this, opts, repo, onEnd) |
101 | + onEnd = onEnd || function(err) { | |
102 | + if (err) throw err | |
103 | + } | |
101 | 104 | |
102 | 105 | var ended |
103 | 106 | var numObjects = -1 |
104 | 107 | var checksum = createHash('sha1') |
@@ -370,10 +373,12 @@ | ||
370 | 373 | cb(null, new Buffer(vals)) |
371 | 374 | } |
372 | 375 | |
373 | 376 | function encodePack(opts, numObjects, readObject) { |
377 | + if (numObjects === undefined) | |
378 | + numObjects = opts, opts = null | |
374 | 379 | if (readObject === undefined) |
375 | - return encodePack.bind(this, numObjects) | |
380 | + return encodePack.bind(this, opts, numObjects) | |
376 | 381 | |
377 | 382 | var header = new Buffer(12) |
378 | 383 | header.write('PACK') |
379 | 384 | header.writeUInt32BE(PACK_VERSION, 4) |
Built with git-ssb-web