Skip to content

Commit 67ccf78

Browse files
authored
fix: preserve unicode in filepaths when commit signing (#3588)
1 parent bb88e27 commit 67ccf78

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

__test__/entrypoint.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ git clone git://127.0.0.1/repos/test-base.git /git/local/repos/test-base
1919
cd /git/local/repos/test-base
2020
git config --global user.email "[email protected]"
2121
git config --global user.name "Your Name"
22-
echo "#test-base" > README_TEMP.md
22+
echo "#test-base" > README→TEMP.md
2323
git add .
2424
git commit -m "initial commit"
2525
git commit --allow-empty -m "empty commit for tests"
26-
echo "#test-base :sparkles:" > README_TEMP.md
26+
echo "#test-base :sparkles:" > README→TEMP.md
2727
git add .
2828
git commit -m "add sparkles" -m "Change description:
29-
- updates README_TEMP.md to add sparkles to the title"
30-
mv README_TEMP.md README.md
29+
- updates README→TEMP.md to add sparkles to the title"
30+
mv README→TEMP.md README.md
3131
git add .
3232
git commit -m "rename readme"
3333
git push -u

__test__/git-command-manager.int.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('git-command-manager integration tests', () => {
2020
expect(initialCommit.signed).toBeFalsy()
2121
expect(initialCommit.changes[0].mode).toEqual('100644')
2222
expect(initialCommit.changes[0].status).toEqual('A')
23-
expect(initialCommit.changes[0].path).toEqual('README_TEMP.md')
23+
expect(initialCommit.changes[0].path).toEqual('README→TEMP.md') // filename contains unicode
2424

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

3838
expect(headCommit.subject).toEqual('rename readme')
3939
expect(headCommit.parents[0]).toEqual(modifiedCommit.sha)
@@ -43,6 +43,6 @@ describe('git-command-manager integration tests', () => {
4343
expect(headCommit.changes[0].path).toEqual('README.md')
4444
expect(headCommit.changes[1].mode).toEqual('100644')
4545
expect(headCommit.changes[1].status).toEqual('D')
46-
expect(headCommit.changes[1].path).toEqual('README_TEMP.md')
46+
expect(headCommit.changes[1].path).toEqual('README→TEMP.md')
4747
})
4848
})

dist/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,8 @@ class GitCommandManager {
772772
return __awaiter(this, void 0, void 0, function* () {
773773
const endOfBody = '###EOB###';
774774
const output = yield this.exec([
775+
'-c',
776+
'core.quotePath=false',
775777
'show',
776778
'--raw',
777779
'--cc',

src/git-command-manager.ts

+2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ export class GitCommandManager {
157157
async getCommit(ref: string): Promise<Commit> {
158158
const endOfBody = '###EOB###'
159159
const output = await this.exec([
160+
'-c',
161+
'core.quotePath=false',
160162
'show',
161163
'--raw',
162164
'--cc',

0 commit comments

Comments
 (0)