I have a problem when using `git format-patch` and `git am` when there are 8-bit (i.e. UTF-8) characters in the log message from line three and below. I have attached a script (`runme.sh`) for reproducing this. It is also available from <http://gist.github.com/378785> in case the attachment is mangled.
My output is this:
$ ./runme.sh
LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8
LC_COLLATE=C
LC_CTYPE=en_GB.utf8 Initialized empty Git repository in /home/sunny/src/git/til_git-lista/dir/.git/
[master (root-commit) 2755112] Initial commit ======== Create commits
[master 9ab743b] First commit without 8-bit chars
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 foo.txt
[master dd5bdf2] Second commit with © in first line of logmsg
1 files changed, 1 insertions(+), 0 deletions(-)
[master 82a445a] Third commit with no 8-bit in first line but €uro further down
1 files changed, 1 insertions(+), 0 deletions(-)
[master 42881f1] Fourth commit with © in first line again
1 files changed, 1 insertions(+), 0 deletions(-) ======== git format-patch firstrev
0001-First-commit-without-8-bit-chars.patch
0002-Second-commit-with-in-first-line-of-logmsg.patch
0003-Third-commit-with-no-8-bit-in-first-line.patch
0004-Fourth-commit-with-in-first-line-again.patch ======== Create new, empty branch and apply patches
Switched to a new branch 'patches'
Applying: First commit without 8-bit chars
Applying: Second commit with © in first line of logmsg
Applying: =?UTF-8?q?Third=20commit=20with=20no=208-bit=20in=20first=20line
Applying: Fourth commit with © in first line again ======== git log
commit 58bcf14aee4b17152ae1f8bd40a24141e93897ec
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 0 seconds agoFourth commit with © in first line again
commit 56e98bd6b161510687abd658728f92b3bd85baf1
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 1 seconds ago=?UTF-8?q?Third=20commit=20with=20no=208-bit=20in=20first=20line
=20but=20=E2=82=ACuro=20further=20down?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit commit 55de5c9008c53a388439f0a0cdb2043d9a36ba6b
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 1 seconds agoSecond commit with © in first line of logmsg
commit af6bf42a07208bc31d537a50562a5997f02e58cb
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 1 seconds agoFirst commit without 8-bit chars
commit 2755112f613687510803e45868751e7b85e3cd1e
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 1 seconds ago Initial commit
$If it’s messed up (wordwrap and such), it’s also available from <http://gist.github.com/raw/378785/output.txt>.
In this case the log message of the third commit (56e98) is unreadable. This only happens when there are characters above U+0080 in the log message, but not in the first line, as that ends up as the subject. Yes, I’ve also tried to remove the "Ø" from the author name, with similar results.
I’m using `git format-patch`/`git am` as an easy way to import/export commits between repositories and directories, and I’m thinking that these commands are probably not intended for that kind of use. Are there any other method or some magic command line options that makes this possible, or is this a bug?
+-| Øyvind A. Holm <sunny@sunbase.org> - N 60.39548° E 5.31735° |-+
| OpenPGP: 0xFB0CBEE894A506E5 - http://www.sunbase.org/pubkey.asc |
| Fingerprint: A006 05D6 E676 B319 55E2 E77E FB0C BEE8 94A5 06E5 |
+------------| 1f818370-50c1-11df-ae95-90e6ba3022ac |-------------+