git-repo-info
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -106,3 +106,6 @@ 'use strict'; | ||
var headFile = fs.readFileSync(headFilePath, {encoding: 'utf8'}); | ||
var branchName = headFile.split('/').slice(-1)[0].trim(); | ||
var branchName = headFile.split('/').slice(2).join('/').trim(); | ||
if (!branchName) { | ||
branchName = headFile.split('/').slice(-1)[0].trim(); | ||
} | ||
var refPath = headFile.split(' ')[1]; | ||
@@ -109,0 +112,0 @@ |
{ | ||
"name": "git-repo-info", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Retrieve current sha and branch name from a git repo.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -130,3 +130,17 @@ 'use strict'; | ||
} | ||
it('returns an object with repo info, including the full branch name, if the branch name includes any slashes', function() { | ||
var repoRoot = path.join(testFixturesPath, 'branch-with-slashes'); | ||
var result = repoInfo(path.join(repoRoot, gitDir)); | ||
var expected = { | ||
branch: 'feature/branch/with/slashes', | ||
sha: '5359aabd3872d9ffd160712e9615c5592dfe6745', | ||
abbreviatedSha: '5359aabd38', | ||
tag: null | ||
}; | ||
assert.deepEqual(result, expected); | ||
}); | ||
}); | ||
}); |
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
44379
65
223