Skip to content

Commit 650b588

Browse files
authored
chore(codegen): git fetch smithy-ts only when necessary (#7380)
1 parent 31fc996 commit 650b588

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/generate-clients/build-smithy-typescript.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ const buildSmithyTypeScript = async (repo, commit) => {
1313
await spawnProcess("git", ["clone", "https://github.com/awslabs/smithy-typescript.git", repo, "--depth=1"]);
1414
}
1515

16-
// Checkout commit
17-
await spawnProcess("git", ["fetch", "origin", commit, "--depth=1"], { cwd: repo });
16+
// Checkout commit (connect to remote only when necessary)
17+
try {
18+
await spawnProcess("git", ["cat-file", "-e", commit], { cwd: repo });
19+
} catch (error) {
20+
await spawnProcess("git", ["fetch", "origin", commit, "--depth=1"], { cwd: repo });
21+
}
1822

1923
// Switch to branch with commit
2024
const tempBranchName = `temp-${commit}`;

0 commit comments

Comments
 (0)