From f64bc1bb33457918eae34b22f214174ba3cf4504 Mon Sep 17 00:00:00 2001 From: Jakub Mazanec Date: Mon, 25 Jul 2022 13:18:36 +0200 Subject: [PATCH] Fixed `getCurrentCommitId` so that the returned value doesn't contain quotation marks on some Windows machines (#889) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix return value of `getCurrentCommitId` * Change the git command used to get the commit hash * Update .changeset/kind-beds-divide.md Co-authored-by: Mateusz BurzyƄski --- .changeset/kind-beds-divide.md | 5 +++++ packages/git/src/index.ts | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/kind-beds-divide.md diff --git a/.changeset/kind-beds-divide.md b/.changeset/kind-beds-divide.md new file mode 100644 index 000000000..f273e5ab2 --- /dev/null +++ b/.changeset/kind-beds-divide.md @@ -0,0 +1,5 @@ +--- +"@changesets/git": patch +--- + +Fixed `getCurrentCommitId` so that the returned value doesn't contain quotation marks on some Windows machines. diff --git a/packages/git/src/index.ts b/packages/git/src/index.ts index 5af8d1ee7..2c65deaae 100644 --- a/packages/git/src/index.ts +++ b/packages/git/src/index.ts @@ -292,9 +292,7 @@ export async function getCurrentCommitId({ }: { cwd: string; }): Promise { - return ( - await spawn("git", ["show", `--format="%h"`, "--no-patch"], { cwd }) - ).stdout + return (await spawn("git", ["rev-parse", "--short", "HEAD"], { cwd })).stdout .toString() .trim(); }