pull-git-repo
Advanced tools
Comparing version 0.4.0 to 0.4.1
44
index.js
@@ -13,2 +13,3 @@ var buffered = require('pull-buffered') | ||
var cat = require('pull-cat') | ||
var semver = require('semver') | ||
@@ -108,2 +109,10 @@ var R = {} | ||
function compareRefNames(a, b) { | ||
try { | ||
return semver.compare(a, b) | ||
} catch(e) { | ||
return a > b ? 1 : a < b ? -1 : 0 | ||
} | ||
} | ||
R.getRefNames = function (pretty, cb) { | ||
@@ -124,3 +133,3 @@ if (typeof pretty == 'function' && !cb) | ||
for (var group in refs) | ||
refs[group].sort() | ||
refs[group].sort(compareRefNames).reverse() | ||
cb(err, refs) | ||
@@ -132,3 +141,3 @@ }) | ||
Repo.parseCommitOrTag = function (object) { | ||
var body = '', state = 'fields' | ||
var body = '', state = 'fields', gpgsig | ||
var done = multicb({ pluck: 1, spread: true }) | ||
@@ -159,3 +168,4 @@ var b = pull( | ||
case 'fields': | ||
return b.lines(end, function (err, line) { | ||
return b.lines(end, gotFieldLine) | ||
function gotFieldLine(err, line) { | ||
if (err) return cb(err) | ||
@@ -181,5 +191,26 @@ if (line === '') { | ||
} | ||
break | ||
case 'gpgsig': | ||
state = 'gpgsig' | ||
gpgsig = [value] | ||
return read(null, cb) | ||
} | ||
cb(null, {name: name, value: value}) | ||
} | ||
} | ||
case 'gpgsig': | ||
return b.lines(end, function next(err, line) { | ||
if (err) return cb(err) | ||
if (line && line[0] === ' ') { | ||
gpgsig.push(line.substr(1)) | ||
b.lines(null, next) | ||
} else if (line === '') { | ||
state = 'title' | ||
var sig = gpgsig.join('\n') | ||
gpgsig = null | ||
cb(null, {name: 'gpgsig', value: sig}) | ||
} else { | ||
state = 'fields' | ||
gotFieldLine(null, line) | ||
} | ||
}) | ||
@@ -303,2 +334,9 @@ case 'title': | ||
R.getTagParsed = function (name, cb) { | ||
this.getRef(name, function (err, object) { | ||
if (err) return cb(err) | ||
Repo.getTagParsed(object, cb) | ||
}) | ||
} | ||
Repo.getCommitParsed = function (object, cb) { | ||
@@ -305,0 +343,0 @@ var commit = { |
{ | ||
"name": "pull-git-repo", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "utility methods for git repos using pull streams", | ||
@@ -31,2 +31,3 @@ "main": "index.js", | ||
"pull-kvdiff": "^0.0.0", | ||
"semver": "^5.1.0", | ||
"stream-to-pull-stream": "^1.6.6" | ||
@@ -33,0 +34,0 @@ }, |
@@ -160,2 +160,6 @@ # pull-git-repo | ||
#### `repo.getTagParsed(rev, cb(err, tag))` | ||
Get a tag object and parse into a JSON object | ||
#### `repo.getFile(rev, path, cb(err, {length, mode, read)` | ||
@@ -162,0 +166,0 @@ |
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
27836
757
194
11
+ Addedsemver@^5.1.0
+ Addedsemver@5.7.2(transitive)