git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git am and CRLF files

From
Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Date
Nov 13, 2009, 09:44 UTC
Message-ID
<4AFD2A8F.7000806@atlas-elektronik.com>

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.
Next: Stefan Naewe
Message 1 of 7 in “git am and CRLF files”
  1. Stefan NaeweNov 13, 2009
  2. Stefan NaeweNov 16, 2009
  3. Nanako ShiraishiNov 16, 2009
  4. Stefan NaeweNov 16, 2009
  5. Erik Faye-LundNov 16, 2009
  6. Daniele SegatoNov 30, 2009
  7. Ismael LucenoNov 30, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.