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>
We want to ensure that files inside .git/ (which have LF line endings)
are edited correctly with Notepad. But we really do not have any
business meddling with other files. So let's only activate the
dos2unix/unix2dos dance, as well as the wrapping of commit messages,
when editing files inside .git/, as suggested by Congyi Wu.
This fixes https://github.com/git-for-windows/git/issues/488
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Uh oh. It seems that the patch that got merged into `master` somehow
was not the patch that was tested, but instead a faulty one.
The problem was that `git config <key>` returns an error if the
key was not found and it made the code fail when no column wrapping
was configured (and besides, the test for the column wrapping was
inverted).
To prove that *this* commit is good, it was made using
git -c core.editor=notepad -c format.commitmessagecolumns=72
commit -s
This fixes https://github.com/git-for-windows/git/issues/517
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
There is a convenient command to build source packages from the same
definitions as the packages were built.
However, the way we built git-extra, we did not really prepare the
sources correctly. As a consequence, a source package would not contain
*any* sources.
Let's fix that.
We need to specify all the source files explicitly. Sadly, this means we
have to put the sources back into a flat file hierarchy due to a bug in
Pacman where it interprets relative paths incorrectly unless they refer
to files in the top-level directory.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Windows' notepad.exe handles only DOS line endings and it cannot wrap
any lines. That makes it less useful as a commit message editor.
So let's wrap it in a shell script that adds DOS line endings before,
and strips them after running notepad.exe.
Also, to make it appropriate as commit message editor, interpret a
new config variable "format.commitMessageColumns" and line-wrap the
commit message accordingly.
This very commit message, in fact, was written using that notepad
wrapper with "format.commitMessageColumns" set to 72.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>