@lerna/describe-ref
Advanced tools
Comparing version 3.1.0 to 3.3.0
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="3.3.0"></a> | ||
# [3.3.0](https://github.com/lerna/lerna/compare/v3.2.1...v3.3.0) (2018-09-06) | ||
### Bug Fixes | ||
* **describe-ref:** Fallback refCount is the number of commits since beginning of repository ([6dfea52](https://github.com/lerna/lerna/commit/6dfea52)) | ||
<a name="3.1.0"></a> | ||
@@ -8,0 +20,0 @@ # [3.1.0](https://github.com/lerna/lerna/compare/v3.0.6...v3.1.0) (2018-08-17) |
@@ -10,3 +10,3 @@ "use strict"; | ||
function getArgs(options = {}) { | ||
function getArgs(options) { | ||
const args = [ | ||
@@ -31,7 +31,7 @@ "describe", | ||
function describeRef(options) { | ||
function describeRef(options = {}) { | ||
const promise = childProcess.exec("git", getArgs(options), options); | ||
return promise.then(({ stdout }) => { | ||
const result = parse(stdout); | ||
const result = parse(stdout, options); | ||
@@ -45,5 +45,5 @@ log.verbose("git-describe", "%j => %j", options && options.match, stdout); | ||
function sync(options) { | ||
function sync(options = {}) { | ||
const stdout = childProcess.execSync("git", getArgs(options), options); | ||
const result = parse(stdout); | ||
const result = parse(stdout, options); | ||
@@ -56,6 +56,12 @@ // only called by collect-updates with no matcher | ||
function parse(stdout) { | ||
if (/^[0-9a-f]{7,40}$/.test(stdout)) { | ||
// fallback received, can't provide full metadata | ||
return { sha: stdout }; | ||
function parse(stdout, options = {}) { | ||
// when git describe fails to locate tags, it returns only the minimal sha | ||
if (/^[0-9a-f]{7,40}/.test(stdout)) { | ||
// repo might still be dirty | ||
const [, sha, isDirty] = /^([0-9a-f]{7,40})(-dirty)?/.exec(stdout); | ||
// count number of commits since beginning of time | ||
const refCount = childProcess.execSync("git", ["rev-list", "--count", sha], options); | ||
return { refCount, sha, isDirty: Boolean(isDirty) }; | ||
} | ||
@@ -62,0 +68,0 @@ |
{ | ||
"name": "@lerna/describe-ref", | ||
"version": "3.1.0", | ||
"version": "3.3.0", | ||
"description": "Parse git describe output for lerna-related tags", | ||
@@ -32,6 +32,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@lerna/child-process": "^3.0.0", | ||
"@lerna/child-process": "^3.3.0", | ||
"npmlog": "^4.1.2" | ||
}, | ||
"gitHead": "7f97c7bca038c690e2dd5d897e222fb5bca0a5e8" | ||
"gitHead": "901e6d54a47151dfed3d6ed2912804b97d05c6b5" | ||
} |
Sorry, the diff of this file is not supported yet
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
5210
52
Updated@lerna/child-process@^3.3.0