Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 0c930a1

Browse files
chirayuktbosch
authored andcommitted
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.
1 parent 2f61b2f commit 0c930a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/versions/version-info.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ var getPreviousVersions = function() {
104104
// always use the remote tags as the local clone might
105105
// not contain all commits when cloned with git clone --depth=...
106106
// Needed e.g. for Travis
107-
var tagResults = shell.exec('git ls-remote --tags | grep -o -e "v[0-9].*[0-9]$"', {silent: true});
107+
var repo_url = currentPackage.repository.url;
108+
var tagResults = shell.exec('git ls-remote --tags ' + repo_url + ' | grep -o -e "v[0-9].*[0-9]$"',
109+
{silent: true});
108110
if ( tagResults.code === 0 ) {
109111
return _(tagResults.output.trim().split('\n'))
110112
.map(function(tag) {
@@ -175,6 +177,6 @@ var getSnapshotVersion = function() {
175177

176178

177179
exports.currentPackage = currentPackage = getPackage();
180+
exports.gitRepoInfo = gitRepoInfo = getGitRepoInfo();
178181
exports.previousVersions = previousVersions = getPreviousVersions();
179182
exports.currentVersion = getTaggedVersion() || getSnapshotVersion();
180-
exports.gitRepoInfo = getGitRepoInfo();

0 commit comments

Comments
 (0)