Skip to content

Instantly share code, notes, and snippets.

@oyvholm
Created April 25, 2010 22:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oyvholm/378785 to your computer and use it in GitHub Desktop.
Save oyvholm/378785 to your computer and use it in GitHub Desktop.
Demo of MIME problem when using git format-patch.

Demo of MIME problem when using git format-patch.

Execute ./runme.sh and enjoy.

$ ./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 ago
Fourth 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 ago
Second commit with © in first line of logmsg
commit af6bf42a07208bc31d537a50562a5997f02e58cb
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 1 seconds ago
First commit without 8-bit chars
commit 2755112f613687510803e45868751e7b85e3cd1e
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 1 seconds ago
Initial commit
$
#!/bin/sh
git=git
[ -e dir ] && { echo \"dir\" already exists. Remove it and try again. >&2; exit 1; }
set | grep -e ^LC_ -e ^LANG
echo
$git init dir
cd dir || { echo Cannot chdir >&2; exit 1; }
$git commit -m "Initial commit" --allow-empty
$git tag firstrev
echo; echo ======== Create commits
echo First line >foo.txt
$git add foo.txt
$git commit -m "First commit without 8-bit chars"
echo Second line >>foo.txt
$git commit -m "Second commit with © in first line of logmsg" -a
echo Third line >>foo.txt
$git commit -m "Third commit with no 8-bit in first line`echo; echo but €uro further down`" -a
echo Fourth line >>foo.txt
$git commit -m "Fourth commit with © in first line again" -a
echo; echo ======== $git format-patch firstrev
$git format-patch firstrev
echo; echo ======== Create new, empty branch and apply patches
$git checkout -b patches firstrev
$git am 0*
echo; echo ======== $git log
$git log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment