git ssb

0+

cel / pull-git-remote-helper



Commit 9da9f411b6480d9e5358ba0bc9c2ac00035edcd8

Fix receive pack callback

Make sure the callback gets called with any errors, only once
Charles Lehner committed on 2/19/2016, 4:35:32 AM
Parent: ae9b54b013d2d66a40e22128321e90346c34ec36

Files changed

index.jschanged
index.jsView
@@ -276,12 +276,12 @@
276276 }
277277
278278 // receive-pack: push from client
279279 function receivePack(read, repo, options) {
280- var ended
281280 var sendRefs = receivePackHeader([
282281 'delete-refs',
283282 ], repo.refs(), true)
283+ var done = multicb({pluck: 1})
284284
285285 return pktLine.encode(
286286 cat([
287287 // send our refs
@@ -296,17 +296,15 @@
296296 pull.collect(function (err, updates) {
297297 if (err) return cb(err)
298298 repo.update(pull.values(updates), pull(
299299 lines.passthrough,
300- pack.decode(repo, onEnd)
301- ), onEnd)
300+ pack.decode(repo, done())
301+ ), done())
302+ done(function (err) {
303+ cb(err || true)
304+ })
302305 })
303306 )
304- function onEnd(err) {
305- if (ended) return
306- ended = err || true
307- cb(err || true)
308- }
309307 },
310308 pull.once('unpack ok')
311309 ])
312310 )

Built with git-ssb-web