pass in the specified git branch ref when cloning a single branch

This commit is contained in:
Alan Crosswell
2021-01-22 13:18:21 -05:00
parent 9ba95e5085
commit ea21f9c12b
2 changed files with 4 additions and 0 deletions
@@ -89,6 +89,7 @@ describe('GitHubPreparer', () => {
expect(mockGitClient.clone).toHaveBeenCalledWith({
url: 'https://github.com/benjdlambert/backstage-graphql-template',
dir: expect.any(String),
ref: expect.any(String),
});
});
@@ -100,6 +101,7 @@ describe('GitHubPreparer', () => {
expect(mockGitClient.clone).toHaveBeenCalledWith({
url: 'https://github.com/benjdlambert/backstage-graphql-template',
dir: expect.any(String),
ref: expect.any(String),
});
});
@@ -42,6 +42,7 @@ export class GithubPreparer implements PreparerBase {
const parsedGitLocation = parseGitUrl(location);
const repositoryCheckoutUrl = parsedGitLocation.toString('https');
const ref = parsedGitLocation.ref;
const tempDir = await fs.promises.mkdtemp(
path.join(workingDirectory, templateId),
);
@@ -63,6 +64,7 @@ export class GithubPreparer implements PreparerBase {
await git.clone({
url: repositoryCheckoutUrl,
ref: ref,
dir: tempDir,
});