git ssb

0+

cel / pull-git-remote-helper



Commit e6b9c24e5ee9397fd4807d48300ea1511f41a55e

Don't send empty pack

Charles Lehner committed on 7/30/2016, 9:13:23 PM
Parent: 447d29c36ed45ee032fa6a0992dbfe00cde5c370

Files changed

index.jschanged
index.jsView
@@ -71,8 +71,9 @@
7171 var sendPack
7272 var wants = {}
7373 var shallows = {}
7474 var aborted
75+ var hasWants
7576 var gotWants
7677
7778 function readWant(abort, cb) {
7879 if (abort) return
@@ -84,8 +85,9 @@
8485 return
8586 }
8687 if (want.type == 'want') {
8788 wants[want.hash] = true
89+ hasWants = true
8890 } else if (want.type == 'shallow') {
8991 shallows[want.hash] = true
9092 } else {
9193 var err = new Error("Unknown thing", want.type, want.hash)
@@ -139,13 +141,14 @@
139141 else readHave(abort, cb)
140142 }
141143 ])),
142144
143- function havesDone(abort, cb) {
145+ function (abort, cb) {
144146 if (abort || aborted) return cb(abort || aborted)
145147 // send pack file to client
146148 if (sendPack)
147149 return sendPack(abort, cb)
150+ if (!hasWants) return cb(true)
148151 getObjects(repo, commonHash, wants, shallows,
149152 function (err, numObjects, readObjects) {
150153 if (err) return cb(err)
151154 var progress = progressObjects(options)
@@ -517,17 +520,9 @@
517520 cb(err, data)
518521 else
519522 next(abort, cb)
520523 } else {
521- // HACK: silence error when writing to closed stream
522- try {
523- cb(null, data)
524- } catch(e) {
525- if (e.message == 'process.stdout cannot be closed.'
526- || e.message == 'This socket is closed.')
527- process.exit(1)
528- throw e
529- }
524+ cb(null, data)
530525 }
531526 })
532527 }
533528 }

Built with git-ssb-web