diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/serve.js | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/lib/serve.js b/lib/serve.js index 7c42d0c..eb8610c 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -22,6 +22,7 @@ var ph = require('pull-hyperscript') var emojis = require('emoji-named-characters') var jpeg = require('jpeg-autorotate') var unzip = require('unzip') +var Catch = require('pull-catch') module.exports = Serve @@ -1788,7 +1789,12 @@ Serve.prototype.gitCommit = function (rev) { : file.mode ? 'mode changed' : JSON.stringify(file)) ]) - }) + }), + Catch(function (err) { + if (err && err.name === 'ObjectNotFoundError') return + if (err && err.name === 'BlobNotFoundError') return self.askWantBlobsForm(err.links) + return false + }) )) ] ]), @@ -1909,23 +1915,8 @@ Serve.prototype.gitTree = function (rev) { ]), missingBlobs ? self.askWantBlobsForm(missingBlobs) : ph('table', [ pull( - self.app.git.readTree(obj), - paramap(function (file, cb) { - self.app.git.getObjectMsg({ - obj: file.hash, - headMsgId: obj.msg.key, - }, function (err, msg) { - if (err && err.name === 'ObjectNotFoundError') return cb(null, file) - if (err && err.name === 'BlobNotFoundError') return cb(null, {missingBlobs: err.links}) - if (err) return cb(err) - file.msg = msg - cb(null, file) - }) - }, 8), + self.app.git.readTreeFull(obj), pull.map(function (item) { - if (item.missingBlobs) { - return self.askWantBlobsForm(item.missingBlobs) - } if (!item.msg) return ph('tr', [ ph('td', u.escapeHTML(item.name) + (item.type === 'tree' ? '/' : '')), @@ -1950,7 +1941,12 @@ Serve.prototype.gitTree = function (rev) { }, htime(fileDate)) ), ]) - }) + }), + Catch(function (err) { + if (err && err.name === 'ObjectNotFoundError') return + if (err && err.name === 'BlobNotFoundError') return self.askWantBlobsForm(err.links) + return false + }) ) ]), ]), |