git ssb

0+

cel / pull-git-remote-helper



Commit 3743a50e99ae0400aabf3a4a34e510181b274aea

Fix thin packfile before uploading it

This fixes previous buggy behavior where the generated pack index file does not
correspond to the uploaded pack file. When git-index-pack fixes a thin pack,
it outputs the fixed pack. So we have to use that instead of the original
(possibly thin) pack. This means that some objects will be included in the pack
that were deltified when they were pushed from the client; however
git-index-pack will not index a thin pack before fixing it, so we have to deal
with this at least until we have a packfile indexer that indexes a thin pack.
Charles Lehner committed on 3/19/2016, 7:50:34 PM
Parent: a22a279107c69519d6303fae61c7e77f1d11672f

Files changed

index.jschanged
lib/index-pack.jschanged
index.jsView
@@ -373,14 +373,13 @@
373373 var progress = progressObjects(options)
374374
375375 if (repo.uploadPack) {
376376 var idxCb = done()
377- var packfile = cache(lines.passthrough)
378- indexPack(packfile(), function (err, idx) {
377+ indexPack(lines.passthrough, function (err, idx, packfileFixed) {
379378 if (err) return idxCb(err)
380379 repo.uploadPack(pull.values(updates), pull.once({
381380 pack: pull(
382- packfile(),
381+ packfileFixed,
383382 // for some reason i was getting zero length buffers which
384383 // were causing muxrpc to fail, so remove them here.
385384 pull.filter(function (buf) {
386385 return buf.length
lib/index-pack.jsView
@@ -16,12 +16,20 @@
1616 })
1717 pull(packFile, toPull.sink(child.stdin))
1818 child.on('close', function (err) {
1919 if (err) return cb(new Error('git index-pack returned ' + err))
20- fs.unlink(packFilename, function (err) {
21- if (err) return cb(err)
22- cb(null, toPull(fs.createReadStream(indexFilename), function (err) {
23- if (err) return console.error(err)
24- }))
25- })
20+ cb(null,
21+ toPull(fs.createReadStream(indexFilename), function (err) {
22+ fs.unlink(indexFilename, function (err) {
23+ if (err) return console.error(err)
24+ })
25+ }),
26+ // the output packfile here is the original packfile transformed to make
27+ // it not thin.
28+ toPull(fs.createReadStream(packFilename), function (err) {
29+ fs.unlink(packFilename, function (err) {
30+ if (err) return console.error(err)
31+ })
32+ })
33+ )
2634 })
2735 }

Built with git-ssb-web