Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: preserve unicode in filepaths when commit signing #3588

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions __test__/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ git clone git://127.0.0.1/repos/test-base.git /git/local/repos/test-base
cd /git/local/repos/test-base
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
echo "#test-base" > README_TEMP.md
echo "#test-base" > README→TEMP.md
git add .
git commit -m "initial commit"
git commit --allow-empty -m "empty commit for tests"
echo "#test-base :sparkles:" > README_TEMP.md
echo "#test-base :sparkles:" > README→TEMP.md
git add .
git commit -m "add sparkles" -m "Change description:
- updates README_TEMP.md to add sparkles to the title"
mv README_TEMP.md README.md
- updates README→TEMP.md to add sparkles to the title"
mv README→TEMP.md README.md
git add .
git commit -m "rename readme"
git push -u
Expand Down
6 changes: 3 additions & 3 deletions __test__/git-command-manager.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('git-command-manager integration tests', () => {
expect(initialCommit.signed).toBeFalsy()
expect(initialCommit.changes[0].mode).toEqual('100644')
expect(initialCommit.changes[0].status).toEqual('A')
expect(initialCommit.changes[0].path).toEqual('README_TEMP.md')
expect(initialCommit.changes[0].path).toEqual('README→TEMP.md') // filename contains unicode

expect(emptyCommit.subject).toEqual('empty commit for tests')
expect(emptyCommit.tree).toEqual(initialCommit.tree) // empty commits have no tree and reference the parent's
Expand All @@ -33,7 +33,7 @@ describe('git-command-manager integration tests', () => {
expect(modifiedCommit.signed).toBeFalsy()
expect(modifiedCommit.changes[0].mode).toEqual('100644')
expect(modifiedCommit.changes[0].status).toEqual('M')
expect(modifiedCommit.changes[0].path).toEqual('README_TEMP.md')
expect(modifiedCommit.changes[0].path).toEqual('README→TEMP.md')

expect(headCommit.subject).toEqual('rename readme')
expect(headCommit.parents[0]).toEqual(modifiedCommit.sha)
Expand All @@ -43,6 +43,6 @@ describe('git-command-manager integration tests', () => {
expect(headCommit.changes[0].path).toEqual('README.md')
expect(headCommit.changes[1].mode).toEqual('100644')
expect(headCommit.changes[1].status).toEqual('D')
expect(headCommit.changes[1].path).toEqual('README_TEMP.md')
expect(headCommit.changes[1].path).toEqual('README→TEMP.md')
})
})
12 changes: 11 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ class GitCommandManager {
return __awaiter(this, void 0, void 0, function* () {
const endOfBody = '###EOB###';
const output = yield this.exec([
'-c',
'core.quotePath=false',
'show',
'--raw',
'--cc',
Expand Down Expand Up @@ -35664,7 +35666,8 @@ __nccwpck_require__.r(__webpack_exports__);

// EXPORTS
__nccwpck_require__.d(__webpack_exports__, {
"default": () => (/* binding */ pLimit)
"default": () => (/* binding */ pLimit),
limitFunction: () => (/* binding */ limitFunction)
});

;// CONCATENATED MODULE: ./node_modules/yocto-queue/index.js
Expand Down Expand Up @@ -35840,6 +35843,13 @@ function pLimit(concurrency) {
return generator;
}

function limitFunction(function_, option) {
const {concurrency} = option;
const limit = pLimit(concurrency);

return (...arguments_) => limit(() => function_(...arguments_));
}

function validateConcurrency(concurrency) {
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
Expand Down
2 changes: 2 additions & 0 deletions src/git-command-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ export class GitCommandManager {
async getCommit(ref: string): Promise<Commit> {
const endOfBody = '###EOB###'
const output = await this.exec([
'-c',
'core.quotePath=false',
'show',
'--raw',
'--cc',
Expand Down