From e1a9df691c91e6793204528df331894efe952484 Mon Sep 17 00:00:00 2001 From: cel Date: Fri, 14 Feb 2020 17:28:14 -0500 Subject: Deduplicate git blob ids --- lib/serve.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/serve.js b/lib/serve.js index 562476d..96f8313 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -3418,13 +3418,21 @@ Serve.prototype.wrapPublic = function (opts) { }) } +function uniqueLink() { + var seen = {} + return function (link) { + if (seen[link.link]) return false + return seen[link.link] = true + } +} + Serve.prototype.askWantBlobsForm = function (links) { var self = this return ph('form', {action: '', method: 'post'}, [ ph('section', [ ph('h3', 'Missing blobs'), ph('p', 'The application needs these blobs to continue:'), - ph('table', links.map(u.toLink).map(function (link) { + ph('table', links.map(u.toLink).filter(uniqueLink()).map(function (link) { if (!u.isRef(link.link)) return return ph('tr', [ ph('td', ph('code', link.link)), -- cgit v1.2.3