fix: use unauthenticated URL to check if branch is up to date
In case the authentication token provided is unauthorized the call to `isBranchUpToDate` will fail due to lack of read permission if that URL is used. As a result the error about outdated local branch will be reported instead of the one about missing permission. By using the original (unauthenticated) URL `isBranchUpToDate` shouldn't fail due to permission as it requires only read permissions, that are necessarly present as the CI wass able to clone the repo.
This commit is contained in:
+6
-6
@@ -206,11 +206,11 @@ test.serial('Throws error if obtaining the tags fails', async t => {
|
||||
});
|
||||
|
||||
test.serial('Return "true" if repository is up to date', async t => {
|
||||
const repositoryUrl = await gitRepo(true);
|
||||
await gitRepo(true);
|
||||
await gitCommits(['First']);
|
||||
await gitPush();
|
||||
|
||||
t.true(await isBranchUpToDate(repositoryUrl, 'master'));
|
||||
t.true(await isBranchUpToDate('master'));
|
||||
});
|
||||
|
||||
test.serial('Return falsy if repository is not up to date', async t => {
|
||||
@@ -220,21 +220,21 @@ test.serial('Return falsy if repository is not up to date', async t => {
|
||||
await gitCommits(['Second']);
|
||||
await gitPush();
|
||||
|
||||
t.true(await isBranchUpToDate(repositoryUrl, 'master'));
|
||||
t.true(await isBranchUpToDate('master'));
|
||||
|
||||
await gitShallowClone(repositoryUrl);
|
||||
await gitCommits(['Third']);
|
||||
await gitPush();
|
||||
process.chdir(repoDir);
|
||||
|
||||
t.falsy(await isBranchUpToDate(repositoryUrl, 'master'));
|
||||
t.falsy(await isBranchUpToDate('master'));
|
||||
});
|
||||
|
||||
test.serial('Return "true" if local repository is ahead', async t => {
|
||||
const repositoryUrl = await gitRepo(true);
|
||||
await gitRepo(true);
|
||||
await gitCommits(['First']);
|
||||
await gitPush();
|
||||
await gitCommits(['Second']);
|
||||
|
||||
t.true(await isBranchUpToDate(repositoryUrl, 'master'));
|
||||
t.true(await isBranchUpToDate('master'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user