ssb-git-repo
Advanced tools
Comparing version 2.7.0 to 2.8.0
@@ -1031,5 +1031,7 @@ var pull = require('pull-stream') | ||
function fetchBlobs(blobs, blobIds, output, cb) { | ||
function fetchBlobs(blobs, blobIds, output, opts, cb) { | ||
var aborted | ||
var fetched = 0 | ||
var wanted = {} | ||
var debounceProgress | ||
@@ -1041,4 +1043,12 @@ function printProgress() { | ||
function printProgressBig() { | ||
output.write('Still waiting for blobs: ' + | ||
Object.keys(wanted).join(' ') + '\n') | ||
} | ||
if (opts.verbosity > 1) debounceProgress = setTimeout(printProgressBig, 5000) | ||
blobIds.forEach(function (blobId) { | ||
if (aborted) return | ||
if (opts.verbosity > 1) output.write('want blob ' + blobId + '\n') | ||
wanted[blobId] = true | ||
blobs.want(blobId, function (err, got) { | ||
@@ -1049,3 +1059,11 @@ if (aborted) return | ||
fetched++ | ||
delete wanted[blobId] | ||
if (output) printProgress() | ||
if (opts.verbosity > 1) { | ||
output.write('got blob ' + blobId + '\n') | ||
if (debounceProgress) clearTimeout(debounceProgress) | ||
if (fetched < blobIds.length) { | ||
debounceProgress = setTimeout(printProgressBig, 5000) | ||
} | ||
} | ||
if (fetched === blobIds.length) cb() | ||
@@ -1089,3 +1107,6 @@ }) | ||
if (!process.env.GITSSB_OLD_PACKS) | ||
Repo.prototype.getPack = function (wants, haves, cb) { | ||
Repo.prototype.getPack = function (wants, haves, opts, cb) { | ||
if (typeof opts === 'function') cb = opts, opts = null | ||
if (!opts) opts = {} | ||
// ensure our id is present | ||
@@ -1095,3 +1116,3 @@ if (!this.sbot.id) return this.sbot.whoami(function (err, feed) { | ||
this.sbot.id = feed.id | ||
this.getPack(wants, haves, cb) | ||
this.getPack(wants, haves, opts, cb) | ||
}.bind(this)) | ||
@@ -1192,3 +1213,3 @@ | ||
var blobs = this.sbot.blobs | ||
fetchBlobs(blobs, blobIds, this.output, function (err) { | ||
fetchBlobs(blobs, blobIds, this.output, opts, function (err) { | ||
if (err) return cb(aborted = err) | ||
@@ -1195,0 +1216,0 @@ packs.forEach(function (pack) { |
@@ -38,1 +38,9 @@ var u = exports | ||
} | ||
u.debounce = function (cb, timeout) { | ||
var timer | ||
return function () { | ||
if (timer) clearTimeout(timer), timer = null | ||
timer = setTimeout(cb, timeout) | ||
} | ||
} |
{ | ||
"name": "ssb-git-repo", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"description": "git repos in secure-scuttlebutt", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -135,3 +135,10 @@ # ssb-git-repo | ||
} ]?, | ||
tags: [ { | ||
sha1: String, | ||
object: String, | ||
type: String?, | ||
tag: String?, | ||
} ]?, | ||
commits_more: Number?, | ||
tags_more: Number?, | ||
num_objects: Number?, | ||
@@ -157,5 +164,10 @@ object_ids: [ String ]?, | ||
`"refs/heads/master"` | ||
- `commits`: array of info about commits that are included in `packs`, for | ||
display purposes | ||
- `commits\_more`: number of commits included in `packs` but not in `commits` | ||
- `commits`: array of info about commits that are included in `packs` | ||
- `commits_more`: number of commits included in `packs` but not in `commits` | ||
- `tags`: array of info about tags that are included in `packs` | ||
- `tag.type`: type of the git object pointed to by the tag, e.g. "commit" | ||
- `tag.object`: id of the git object pointed to by the tag | ||
- `tag.tag`: name of the tag | ||
- `tag.sha1`: id of the tag | ||
- `tags_more`: number of tags included in `packs` but not in `tags` | ||
- `num_objects`: number of objects included in `packs` | ||
@@ -162,0 +174,0 @@ - `object_ids`: sha1 hashes of git objects included in `packs`, other than |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55749
1508
186