git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Ruhnke <grumbel@gmail.com>
To: git@vger.kernel.org
Subject: Problems with format-patch UTF-8 and a missing second empty line
Date: Thu, 15 Sep 2011 11:45:15 +0200	[thread overview]
Message-ID: <CAHz1FYgPuMHLC+f2mFqD73=NGXQSStRPDOsiCy-HtaWKbHu7NQ@mail.gmail.com> (raw)

Creating a patch of a commit including UTF-8 and no empty second line,
like this:

mkdir foobar
cd foobar
git init
echo "Hello World" > file
git add file
git commit -m "ÄÖÜ
ÄÖÜ" file
git format-patch --root HEAD --stdout

Results in this:

From f4f889bad560c479a70fbf5f70a4239576001262 Mon Sep 17 00:00:00 2001
From: Ingo Ruhnke <grumbel@gmail.com>
Date: Thu, 15 Sep 2011 11:25:11 +0200
Subject: [PATCH] =?UTF-8?q?=C3=84=C3=96=C3=9C
=20=C3=84=C3=96=C3=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
...

Trying to apply the patch then results in this:

$ git am /tmp/foobar/0001-.patch
Applying: =?UTF-8?q?=C3=84=C3=96=C3=9C
applying to an empty history
$ git log
commit 6f27fc51a8c52fdb595131a934d8d56c9df3b5c0
Author: Ingo Ruhnke <grumbel@gmail.com>
Date:   Thu Sep 15 11:27:47 2011 +0200

    =?UTF-8?q?=C3=84=C3=96=C3=9C

    =20=C3=84=C3=96=C3=9C?=
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit

The UTF-8 stuff doesn't get decoded and the log message ends up broken.

The problem seems to already start with just the lack of an empty second line:

mkdir foobar
cd foobar
git init
echo "Hello World" > file
git add file
git commit -m "ABC
ABC" file
git format-patch --root HEAD --stdout

From 3abc0e59abc4c9343d22e79575e02910073d1013 Mon Sep 17 00:00:00 2001
From: Ingo Ruhnke <grumbel@gmail.com>
Date: Thu, 15 Sep 2011 11:31:03 +0200
Subject: [PATCH] ABC
 ABC

$ git am /tmp/foobar/0001-ABC.patch
Applying: ABC ABC
applying to an empty history
ingo@duo:/tmp/5/bar$ git log | cat
commit eb8a9e9a1421ae6d930d99bfb8f2eab47349c387
Author: Ingo Ruhnke <grumbel@gmail.com>
Date:   Thu Sep 15 11:31:03 2011 +0200

    ABC ABC

Here the newline between ABC\nABC gets stripped out and replaced with
a space when transferring the commit with format-patch from one
repository to another.

Inserting an empty second line in the commit message makes both
problems go away.

Another small issue is that the filename of the patch will strip out
any UTF-8 characters, Thus a commit message of "123Äöü456" will result
in "0001-123-456.patch".

The problems happen with git version 1.7.4.1 (4b5eac7f0) on Ubuntu 11.04.

-- 
Blog:     http://grumbel.blogspot.com/
JabberID: xmpp:grumbel@jabber.org
ICQ:      59461927

             reply	other threads:[~2011-09-15  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15  9:45 Ingo Ruhnke [this message]
2011-09-15 15:17 ` Problems with format-patch UTF-8 and a missing second empty line Jeff King
     [not found]   ` <20110915224456.14410ed8@zappedws>
2011-09-15 18:50     ` Jeff King
2011-09-15 20:05       ` Alexey Shumkin
2011-09-15 20:33         ` Jeff King
2011-09-15 19:01 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHz1FYgPuMHLC+f2mFqD73=NGXQSStRPDOsiCy-HtaWKbHu7NQ@mail.gmail.com' \
    --to=grumbel@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).