git-extra: force the Notepad helper to use UTF-8
When Notepad is set as commit message editor, this fix adds a UTF-8 BOM to the file before Notepad opens the file. This way Notepad is forced to read and save the file as UTF-8, allowing commit messages with international characters. Previosly Notepad opened and saved the file in some ANSI codepage, while Git was reading the file as UTF-8 creating problems when international charaters were written. The fix takes into account rares cases when we manually use other encoding than UTF-8 for commit messegas via the git config i18n.commitencoding variable. Now Notepad is completely usable as commit message editor without using external tools like Gitpad. Note: as previously, this special handling only applies if the `notepad` script is called with a path indicating a file residing inside the `.git/` directory. [jes: adjusted code style, fixed checksums, clarified that this really only affects Git files] This fixes https://github.com/git-for-windows/git/issues/818 and closes https://github.com/git-for-windows/build-extra/pull/123. Signed-off-by: Dimitrij Mijoski <dmjpp@hotmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Родитель
be72db6bdc
Коммит
b8c692385f
|
@ -37,7 +37,7 @@ source=('inputrc'
|
|||
md5sums=('3fab57079f0322efe256e95fe29d516f'
|
||||
'e7ad03fffc29e619e402dbd5ec9ef74c'
|
||||
'bfb591886b2a28af3334521e71198b74'
|
||||
'6ad699cbc3c4693fa75fb5d5d25d0e26'
|
||||
'11d0e9aad647db83c56d9a89608baf11'
|
||||
'e3b411a4f2e6553e41d0c4261160dd7d'
|
||||
'fb92ea53ef01b4f60ed04eabac81e2c7'
|
||||
'7180794bfa88c1f687c1a7940fc62293'
|
||||
|
|
|
@ -15,7 +15,10 @@ die "Usage: $0 <file>"
|
|||
|
||||
if test -f "$1"
|
||||
then
|
||||
unix2dos.exe "$1"
|
||||
case "$(git config i18n.commitencoding 2>/dev/null)" in
|
||||
''|utf-8|utf8) unix2dos.exe -m "$1";;
|
||||
*) unix2dos.exe "$1";;
|
||||
esac
|
||||
fi &&
|
||||
notepad.exe "$1" &&
|
||||
dos2unix.exe "$1" &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче