From ed5c31198ea114802d49405e1a5ec504ad39d69f Mon Sep 17 00:00:00 2001 From: Tyler Butler Date: Mon, 3 Mar 2025 14:31:23 -0800 Subject: [PATCH 1/3] fix(build-cli): Fix up-to-date branch check --- build-tools/packages/build-cli/src/library/git.ts | 8 +++++--- .../packages/build-cli/src/library/releasePrepChecks.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build-tools/packages/build-cli/src/library/git.ts b/build-tools/packages/build-cli/src/library/git.ts index 9df6771a464c..9c24c9db42a6 100644 --- a/build-tools/packages/build-cli/src/library/git.ts +++ b/build-tools/packages/build-cli/src/library/git.ts @@ -165,9 +165,11 @@ export class Repository implements GitContext { public async getShaForBranch(branch: string, remote?: string): Promise { const refspec = remote === undefined ? `refs/heads/${branch}` : `refs/remotes/${remote}/${branch}`; + // result is a string of the form 64adcdba56deb16e0641c91ca825401a9f7a01f9 refs/heads/release/client/2.23 const result = await this.git.raw(`show-ref`, refspec); - return result; + const [sha] = result.split(" "); + return sha; } /** @@ -459,13 +461,13 @@ export class Repository implements GitContext { const currentSha = await this.getShaForBranch(branch); const remoteSha = await this.getShaForBranch(branch, remote); return remoteSha === currentSha; - } + } /** * Fetch branch */ public async fetchBranch(remote: string, branchName: string): Promise { - await this.gitClient.fetch(remote, [branchName]); + await this.gitClient.fetch(remote, branchName); } } diff --git a/build-tools/packages/build-cli/src/library/releasePrepChecks.ts b/build-tools/packages/build-cli/src/library/releasePrepChecks.ts index 24c297895c21..af48f19b6e3e 100644 --- a/build-tools/packages/build-cli/src/library/releasePrepChecks.ts +++ b/build-tools/packages/build-cli/src/library/releasePrepChecks.ts @@ -135,7 +135,7 @@ export const CheckHasRemoteBranchUpToDate: CheckFunction = async ( return { message: `Error when checking remote branch. Does the remote branch exist? Full error message:\n${ (error as Error).message - }`, + }\n${(error as Error).stack}`, }; } From 3a26662ce716f09ba7701ad0a380f1b2f183b9b4 Mon Sep 17 00:00:00 2001 From: Tyler Butler Date: Mon, 3 Mar 2025 14:36:17 -0800 Subject: [PATCH 2/3] Update build-tools/packages/build-cli/src/library/git.ts --- build-tools/packages/build-cli/src/library/git.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/packages/build-cli/src/library/git.ts b/build-tools/packages/build-cli/src/library/git.ts index 9c24c9db42a6..dc975037240f 100644 --- a/build-tools/packages/build-cli/src/library/git.ts +++ b/build-tools/packages/build-cli/src/library/git.ts @@ -165,7 +165,7 @@ export class Repository implements GitContext { public async getShaForBranch(branch: string, remote?: string): Promise { const refspec = remote === undefined ? `refs/heads/${branch}` : `refs/remotes/${remote}/${branch}`; - // result is a string of the form 64adcdba56deb16e0641c91ca825401a9f7a01f9 refs/heads/release/client/2.23 + // result is a string of the form '64adcdba56deb16e0641c91ca825401a9f7a01f9 refs/heads/release/client/2.23' const result = await this.git.raw(`show-ref`, refspec); const [sha] = result.split(" "); From 4c4075054c71b9d49ddbdb345156e140e2ee3a52 Mon Sep 17 00:00:00 2001 From: Tyler Butler Date: Mon, 3 Mar 2025 14:36:41 -0800 Subject: [PATCH 3/3] format --- build-tools/packages/build-cli/src/library/git.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/packages/build-cli/src/library/git.ts b/build-tools/packages/build-cli/src/library/git.ts index dc975037240f..c62402684f2f 100644 --- a/build-tools/packages/build-cli/src/library/git.ts +++ b/build-tools/packages/build-cli/src/library/git.ts @@ -461,7 +461,7 @@ export class Repository implements GitContext { const currentSha = await this.getShaForBranch(branch); const remoteSha = await this.getShaForBranch(branch, remote); return remoteSha === currentSha; - } + } /** * Fetch branch