Add missing ref fix that was applied to github and gitlab.

This commit is contained in:
Alan Crosswell
2021-01-22 15:01:01 -05:00
parent ea21f9c12b
commit 00d9d6ae45
2 changed files with 7 additions and 4 deletions
@@ -89,6 +89,7 @@ describe('BitbucketPreparer', () => {
expect(mockGitClient.clone).toHaveBeenCalledWith({
url: 'https://bitbucket.org/backstage-project/backstage-repo',
dir: expect.any(String),
ref: expect.any(String),
});
});
@@ -113,6 +114,7 @@ describe('BitbucketPreparer', () => {
expect(mockGitClient.clone).toHaveBeenCalledWith({
url: 'https://bitbucket.org/backstage-project/backstage-repo',
dir: expect.any(String),
ref: expect.any(String),
});
});
@@ -49,15 +49,15 @@ export class BitbucketPreparer implements PreparerBase {
const logger = opts.logger;
const templateId = template.metadata.name;
const repo = parseGitUrl(location);
const repositoryCheckoutUrl = repo.toString('https');
const parsedGitLocation = parseGitUrl(location);
const repositoryCheckoutUrl = parsedGitLocation.toString('https');
const ref = parsedGitLocation.ref;
const tempDir = await fs.promises.mkdtemp(
path.join(workingDirectory, templateId),
);
const templateDirectory = path.join(
`${path.dirname(repo.filepath)}`,
`${path.dirname(parsedGitLocation.filepath)}`,
template.spec.path ?? '.',
);
@@ -73,6 +73,7 @@ export class BitbucketPreparer implements PreparerBase {
await git.clone({
url: repositoryCheckoutUrl,
ref: ref,
dir: tempDir,
});