+3
-3
@@ -183,7 +183,7 @@ test('Add tag on head commit', async t => {
|
||||
const {cwd} = await gitRepo();
|
||||
const commits = await gitCommits(['Test commit'], {cwd});
|
||||
|
||||
await tag({gitTag: 'tag_name', gitHead: 'HEAD', version: '1.0.0'}, {cwd});
|
||||
await tag('tag_name', 'HEAD', {cwd});
|
||||
|
||||
await t.is(await gitCommitTag(commits[0].hash, {cwd}), 'tag_name');
|
||||
});
|
||||
@@ -193,7 +193,7 @@ test('Push tag to remote repository', async t => {
|
||||
const {cwd, repositoryUrl} = await gitRepo(true);
|
||||
const commits = await gitCommits(['Test commit'], {cwd});
|
||||
|
||||
await tag({gitTag: 'tag_name', gitHead: 'HEAD', version: '1.0.0'}, {cwd});
|
||||
await tag('tag_name', 'HEAD', {cwd});
|
||||
await push(repositoryUrl, {cwd});
|
||||
|
||||
t.is(await gitRemoteTagHead(repositoryUrl, 'tag_name', {cwd}), commits[0].hash);
|
||||
@@ -207,7 +207,7 @@ test('Push tag to remote repository with remote branch ahead', async t => {
|
||||
await gitCommits(['Second'], {cwd: tmpRepo});
|
||||
await gitPush('origin', 'master', {cwd: tmpRepo});
|
||||
|
||||
await tag({gitTag: 'tag_name', gitHead: 'HEAD', version: '1.0.0'}, {cwd});
|
||||
await tag('tag_name', 'HEAD', {cwd});
|
||||
await push(repositoryUrl, {cwd});
|
||||
|
||||
t.is(await gitRemoteTagHead(repositoryUrl, 'tag_name', {cwd}), commits[0].hash);
|
||||
|
||||
@@ -195,7 +195,7 @@ export function gitTagHead(tagName, execaOpts) {
|
||||
* @return {String} The sha of the commit associated with `tagName` on the remote repository.
|
||||
*/
|
||||
export async function gitRemoteTagHead(repositoryUrl, tagName, execaOpts) {
|
||||
return (await execa.stdout('git', ['ls-remote', repositoryUrl, `${tagName}^{}`], execaOpts))
|
||||
return (await execa.stdout('git', ['ls-remote', '--tags', repositoryUrl, tagName], execaOpts))
|
||||
.split('\n')
|
||||
.filter(tag => Boolean(tag))
|
||||
.map(tag => tag.match(/^(\S+)/)[1])[0];
|
||||
|
||||
Reference in New Issue
Block a user