* git am and CRLF files
@ 2009-11-13 9:44 Stefan Naewe
2009-11-16 7:33 ` Stefan Naewe
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Naewe @ 2009-11-13 9:44 UTC (permalink / raw)
To: git
Hi there.
I have:
$ git version
git version 1.6.5.1.1367.gcd48
$ git config --get core.autocrlf
false
A repository with some UNIX (LF) and some Windows (CRLF) files.
(and no: I will not change the files. My editors handle CRLF and LF correctly)
My problem:
'git am' can't handle changes in CRLF files because the patch
gets converted (by git mailsplit) to contain only LF.
Which is wrong IMHO.
git-am on my msysgit version looks like this (lines: 214++)
<---------->
split_patches () {
case "$patch_format" in
mbox)
case "$rebasing" in
'')
keep_cr= ;;
?*)
keep_cr=--keep-cr ;;
esac
git mailsplit -d"$prec" -o"$dotest" -b $keep_cr -- "$@" > "$dotest/last" ||
clean_abort
;;
<---------->
The '--keep-cr' flags is passed to git mailsplit when git am is in 'rebasing' mode.
By looking through git-am I found that I can pass "--rebasing" to git am to get my
patch applied correctly.
But why is git am behaving that way ?
Puzzled,
Stefan
--
----------------------------------------------------------------
/dev/random says: I'm dangerous when I know what I'm doing.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git am and CRLF files
2009-11-13 9:44 git am and CRLF files Stefan Naewe
@ 2009-11-16 7:33 ` Stefan Naewe
2009-11-16 10:50 ` Nanako Shiraishi
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Naewe @ 2009-11-16 7:33 UTC (permalink / raw)
To: git@vger.kernel.org
On 11/13/2009 10:44 AM, Stefan Naewe wrote:
> Hi there.
> I have:
>
> $ git version
> git version 1.6.5.1.1367.gcd48
>
> $ git config --get core.autocrlf
> false
>
> A repository with some UNIX (LF) and some Windows (CRLF) files.
> (and no: I will not change the files. My editors handle CRLF and LF correctly)
>
> My problem:
>
> 'git am' can't handle changes in CRLF files because the patch
> gets converted (by git mailsplit) to contain only LF.
>
> Which is wrong IMHO.
>
> git-am on my msysgit version looks like this (lines: 214++)
>
> <---------->
> split_patches () {
> case "$patch_format" in
> mbox)
> case "$rebasing" in
> '')
> keep_cr= ;;
> ?*)
> keep_cr=--keep-cr ;;
> esac
> git mailsplit -d"$prec" -o"$dotest" -b $keep_cr -- "$@" > "$dotest/last" ||
> clean_abort
> ;;
> <---------->
>
> The '--keep-cr' flags is passed to git mailsplit when git am is in 'rebasing' mode.
> By looking through git-am I found that I can pass "--rebasing" to git am to get my
> patch applied correctly.
> But why is git am behaving that way ?
>
> Puzzled,
>
> Stefan
Does anyone have any comment on this ?
Regards,
Stefan
--
----------------------------------------------------------------
/dev/random says: Microsoft Windows... a virus with mouse support.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git am and CRLF files
2009-11-16 7:33 ` Stefan Naewe
@ 2009-11-16 10:50 ` Nanako Shiraishi
2009-11-16 11:15 ` Stefan Naewe
2009-11-16 11:43 ` Erik Faye-Lund
0 siblings, 2 replies; 7+ messages in thread
From: Nanako Shiraishi @ 2009-11-16 10:50 UTC (permalink / raw)
To: Stefan Naewe; +Cc: git@vger.kernel.org
Quoting Stefan Naewe <stefan.naewe@atlas-elektronik.com>
>> A repository with some UNIX (LF) and some Windows (CRLF) files.
>> (and no: I will not change the files. My editors handle CRLF and LF correctly)
>>
>> My problem:
>>
>> 'git am' can't handle changes in CRLF files because the patch
>> gets converted (by git mailsplit) to contain only LF.
>
>> Stefan
>
> Does anyone have any comment on this ?
This was done very much on purpose.
The "am" command is meant to handle e-mailed patches, and traditionally
mails are known to clobber carriage returns.
See commit c2ca1d79dbd54b06a05e5d14a897699e59dc9f9f
Allow mailsplit (and hence git-am) to handle mails with CRLF line-endings
It is not that uncommon to have mails with DOS line-ending, notably
Thunderbird and web mailers like Gmail (when saving what they call
"original" message). So modify mailsplit to convert CRLF line-endings to
just LF.
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git am and CRLF files
2009-11-16 10:50 ` Nanako Shiraishi
@ 2009-11-16 11:15 ` Stefan Naewe
2009-11-16 11:43 ` Erik Faye-Lund
1 sibling, 0 replies; 7+ messages in thread
From: Stefan Naewe @ 2009-11-16 11:15 UTC (permalink / raw)
To: Nanako Shiraishi; +Cc: git@vger.kernel.org
On 11/16/2009 11:50 AM, Nanako Shiraishi wrote:
> Quoting Stefan Naewe <stefan.naewe@atlas-elektronik.com>
>
>>> A repository with some UNIX (LF) and some Windows (CRLF) files.
>>> (and no: I will not change the files. My editors handle CRLF and LF correctly)
>>>
>>> My problem:
>>>
>>> 'git am' can't handle changes in CRLF files because the patch
>>> gets converted (by git mailsplit) to contain only LF.
>>> Stefan
>> Does anyone have any comment on this ?
>
> This was done very much on purpose.
>
> The "am" command is meant to handle e-mailed patches, and traditionally
> mails are known to clobber carriage returns.
>
> See commit c2ca1d79dbd54b06a05e5d14a897699e59dc9f9f
>
> Allow mailsplit (and hence git-am) to handle mails with CRLF line-endings
>
> It is not that uncommon to have mails with DOS line-ending, notably
> Thunderbird and web mailers like Gmail (when saving what they call
> "original" message). So modify mailsplit to convert CRLF line-endings to
> just LF.
>
I've noticed that.
But converting everything just breaks git am for CRLF files, doesn't it ?
Wouldn't it be possible (and sensible) to not convert the diff text, but
only the rest (mail text, headers, etc.) ?
Regards,
Stefan
--
----------------------------------------------------------------
/dev/random says: Change is inevitable, except from a vending machine.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git am and CRLF files
2009-11-16 10:50 ` Nanako Shiraishi
2009-11-16 11:15 ` Stefan Naewe
@ 2009-11-16 11:43 ` Erik Faye-Lund
2009-11-30 12:06 ` Daniele Segato
1 sibling, 1 reply; 7+ messages in thread
From: Erik Faye-Lund @ 2009-11-16 11:43 UTC (permalink / raw)
To: Nanako Shiraishi; +Cc: Stefan Naewe, git@vger.kernel.org
On Mon, Nov 16, 2009 at 11:50 AM, Nanako Shiraishi <nanako3@lavabit.com> wrote:
> Quoting Stefan Naewe <stefan.naewe@atlas-elektronik.com>
>
>>> A repository with some UNIX (LF) and some Windows (CRLF) files.
>>> (and no: I will not change the files. My editors handle CRLF and LF correctly)
>>>
>>> My problem:
>>>
>>> 'git am' can't handle changes in CRLF files because the patch
>>> gets converted (by git mailsplit) to contain only LF.
>>
>>> Stefan
>>
>> Does anyone have any comment on this ?
>
> This was done very much on purpose.
>
> The "am" command is meant to handle e-mailed patches, and traditionally
> mails are known to clobber carriage returns.
>
According to RFC 5322, email messages use CRLF as the
newline-sequence. In order to be able to distinguish between CRLF and
LF in an e-mail patch, the message needs to be use some
transfer-encoding that preserves newline style (like base64).
Perhaps this would be better fixed by having format-patch (or prehaps
the MUA ?) base64-encode the message body if the file contains
non-LF-newlines, and normalizing CRLF to LF before transport-decoding?
Or does some MUAs transport-decode before storing the message to disk?
I realize this might make it a bit tricky to review patches that
contains CRLF-newlines before mailing them out, but perhaps inspecting
the format-patch output is the wrong place to do this?
--
Erik "kusma" Faye-Lund
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git am and CRLF files
2009-11-16 11:43 ` Erik Faye-Lund
@ 2009-11-30 12:06 ` Daniele Segato
2009-11-30 12:50 ` Ismael Luceno
0 siblings, 1 reply; 7+ messages in thread
From: Daniele Segato @ 2009-11-30 12:06 UTC (permalink / raw)
To: kusmabite; +Cc: Nanako Shiraishi, Stefan Naewe, git@vger.kernel.org
On Mon, Nov 16, 2009 at 12:43 PM, Erik Faye-Lund
<kusmabite@googlemail.com> wrote:
> According to RFC 5322, email messages use CRLF as the
> newline-sequence. In order to be able to distinguish between CRLF and
> LF in an e-mail patch, the message needs to be use some
> transfer-encoding that preserves newline style (like base64).
>
> Perhaps this would be better fixed by having format-patch (or prehaps
> the MUA ?) base64-encode the message body if the file contains
> non-LF-newlines, and normalizing CRLF to LF before transport-decoding?
> Or does some MUAs transport-decode before storing the message to disk?
>
> I realize this might make it a bit tricky to review patches that
> contains CRLF-newlines before mailing them out, but perhaps inspecting
> the format-patch output is the wrong place to do this?
why don't adding that information in the mail header?
or may be made format-patch create a "comment line" with that information?
if that line is missing it could keep the default behavior (what it
did until now)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git am and CRLF files
2009-11-30 12:06 ` Daniele Segato
@ 2009-11-30 12:50 ` Ismael Luceno
0 siblings, 0 replies; 7+ messages in thread
From: Ismael Luceno @ 2009-11-30 12:50 UTC (permalink / raw)
To: Daniele Segato; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]
Daniele Segato escribió:
> On Mon, Nov 16, 2009 at 12:43 PM, Erik Faye-Lund
> <kusmabite@googlemail.com> wrote:
>> According to RFC 5322, email messages use CRLF as the
>> newline-sequence. In order to be able to distinguish between CRLF and
>> LF in an e-mail patch, the message needs to be use some
>> transfer-encoding that preserves newline style (like base64).
>>
>> Perhaps this would be better fixed by having format-patch (or prehaps
>> the MUA ?) base64-encode the message body if the file contains
>> non-LF-newlines, and normalizing CRLF to LF before transport-decoding?
>> Or does some MUAs transport-decode before storing the message to disk?
>>
>> I realize this might make it a bit tricky to review patches that
>> contains CRLF-newlines before mailing them out, but perhaps inspecting
>> the format-patch output is the wrong place to do this?
>
>
> why don't adding that information in the mail header?
> or may be made format-patch create a "comment line" with that information?
>
> if that line is missing it could keep the default behavior (what it
> did until now)
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
It would make more sense to simply use MIME attachments...
--
Ismael Luceno
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-11-30 12:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13 9:44 git am and CRLF files Stefan Naewe
2009-11-16 7:33 ` Stefan Naewe
2009-11-16 10:50 ` Nanako Shiraishi
2009-11-16 11:15 ` Stefan Naewe
2009-11-16 11:43 ` Erik Faye-Lund
2009-11-30 12:06 ` Daniele Segato
2009-11-30 12:50 ` Ismael Luceno
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).