From 78dff4e9edf968b44a0f859a2c29ce614ec3fdde Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:14:28 +0900 Subject: [PATCH] chore: extend commit hash correctly when ambigious with a non-commit object --- packages/vite/CHANGELOG.md | 2 +- scripts/extendCommitHash.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md index 4baedf1f5adb4c..54dfbf405e2198 100644 --- a/packages/vite/CHANGELOG.md +++ b/packages/vite/CHANGELOG.md @@ -13,7 +13,7 @@ * test: convert config playground to unit tests (#19568) ([c0e68da](https://github.com/vitejs/vite/commit/c0e68da4774f3487e9ba0c4d4d2c5e76bdc890ea)), closes [#19568](https://github.com/vitejs/vite/issues/19568) * test: convert resolve-config playground to unit tests (#19567) ([db5fb48](https://github.com/vitejs/vite/commit/db5fb48f5d4c1ee411e59c1e9b70d62fdb9d53d2)), closes [#19567](https://github.com/vitejs/vite/issues/19567) * perf: flush compile cache after 10s (#19537) ([6c8a5a2](https://github.com/vitejs/vite/commit/6c8a5a27e645a182f5b03a4ed6aa726eab85993f)), closes [#19537](https://github.com/vitejs/vite/issues/19537) -* chore(css): move environment destructuring after condition check (#19492) ([c9eda23](https://github.com/vitejs/vite/commit/c9eda23)), closes [#19492](https://github.com/vitejs/vite/issues/19492) +* chore(css): move environment destructuring after condition check (#19492) ([c9eda23](https://github.com/vitejs/vite/commit/c9eda2348c244d591d23f131c6ddf262b256cbf0)), closes [#19492](https://github.com/vitejs/vite/issues/19492) * chore(html): remove unnecessary value check (#19491) ([797959f](https://github.com/vitejs/vite/commit/797959f01da583b85a0be1dc89f762fd01d138db)), closes [#19491](https://github.com/vitejs/vite/issues/19491) diff --git a/scripts/extendCommitHash.ts b/scripts/extendCommitHash.ts index 4df9856f4dc272..60e0ae674154d4 100644 --- a/scripts/extendCommitHash.ts +++ b/scripts/extendCommitHash.ts @@ -11,7 +11,9 @@ export default function extendCommitHash(path: string): void { while ((match = matchHashReg.exec(content))) { const shortHash = match[1] try { - const longHash = execSync(`git rev-parse ${shortHash}`).toString().trim() + const longHash = execSync(`git rev-parse "${shortHash}^{commit}"`) + .toString() + .trim() content = content.replace(`${base}${shortHash}`, `${base}${longHash}`) } catch {} }