Skip to content

Commit 83f37d7

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 angular#6678.
1 parent d4ac254 commit 83f37d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/versions/version-info.js

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

175177

176178
exports.currentPackage = currentPackage = getPackage();
179+
exports.gitRepoInfo = gitRepoInfo = getGitRepoInfo();
177180
exports.previousVersions = previousVersions = getPreviousVersions();
178181
exports.currentVersion = getTaggedVersion() || getSnapshotVersion();
179-
exports.gitRepoInfo = getGitRepoInfo();

0 commit comments

Comments
 (0)