Skip to content

Commit

Permalink
Fixed getCurrentCommitId so that the returned value doesn't contain…
Browse files Browse the repository at this point in the history
… quotation marks on some Windows machines (#889)

* 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 <mateuszburzynski@gmail.com>
  • Loading branch information
jakubmazanec and Andarist committed Jul 25, 2022
1 parent e420482 commit f64bc1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .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.
4 changes: 1 addition & 3 deletions packages/git/src/index.ts
Expand Up @@ -292,9 +292,7 @@ export async function getCurrentCommitId({
}: {
cwd: string;
}): Promise<string> {
return (
await spawn("git", ["show", `--format="%h"`, "--no-patch"], { cwd })
).stdout
return (await spawn("git", ["rev-parse", "--short", "HEAD"], { cwd })).stdout
.toString()
.trim();
}

0 comments on commit f64bc1b

Please sign in to comment.