fix(version-info): explicitly specify the remote

`git ls-remote --tags` assumes that you have a remote set up for your
current branch.  That isn't the case, at least for me, when I'm working
on local branches.  `grunt write` doesn't do the right thing in that
case (`git ls-remote --tags` bails out and the silent: true param makes
this a pain to debug.)  Prefer explicit to implicit.

Closes #6678.
This commit is contained in:
Chirayu Krishnappa
2014-03-13 17:42:43 -07:00
committed by Tobias Bosch
parent 2f61b2f045
commit 0c930a1a86

View File

@@ -104,7 +104,9 @@ var getPreviousVersions = function() {
// always use the remote tags as the local clone might
// not contain all commits when cloned with git clone --depth=...
// Needed e.g. for Travis
var tagResults = shell.exec('git ls-remote --tags | grep -o -e "v[0-9].*[0-9]$"', {silent: true});
var repo_url = currentPackage.repository.url;
var tagResults = shell.exec('git ls-remote --tags ' + repo_url + ' | grep -o -e "v[0-9].*[0-9]$"',
{silent: true});
if ( tagResults.code === 0 ) {
return _(tagResults.output.trim().split('\n'))
.map(function(tag) {
@@ -175,6 +177,6 @@ var getSnapshotVersion = function() {
exports.currentPackage = currentPackage = getPackage();
exports.gitRepoInfo = gitRepoInfo = getGitRepoInfo();
exports.previousVersions = previousVersions = getPreviousVersions();
exports.currentVersion = getTaggedVersion() || getSnapshotVersion();
exports.gitRepoInfo = getGitRepoInfo();