git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-archive and core.eol
@ 2010-12-15 22:32 Erik Faye-Lund
  2011-01-08 13:35 ` René Scharfe
  0 siblings, 1 reply; 7+ messages in thread
From: Erik Faye-Lund @ 2010-12-15 22:32 UTC (permalink / raw)
  To: Git Mailing List, msysGit; +Cc: eyvind.bernhardsen

I recently tried the following on Windows:

$ git init
Initialized empty Git repository in c:/Users/kusma/test/.git/
$ echo "foo
bar" > test.txt
$ git -c core.autocrlf=true add test.txt
warning: LF will be replaced by CRLF in test.txt.
The file will have its original line endings in your working directory.
$ git commit -m.
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
$ git -c core.autocrlf=true -c core.eol=lf archive --format=tar HEAD > test.tar
$ tar xvf test.tar
$ od -c test.txt
0000000   f   o   o  \r  \n   b   a   r  \r  \n
0000012

Just to be sure, I checked this:

$ git show HEAD:test.txt | od -c
0000000   f   o   o  \n   b   a   r  \n
0000010

Yep, the file has LF in the repo, as expected... the warning from
git-add is a bit confusing, but OK.

Hmm, so git-archive writes CRLF even if I said I wanted LF. But then I
tried this on Linux:

$ git init
Initialized empty Git repository in /home/kusma/src/test/.git/
$ echo "foo
bar" > test.txt
$ git add test.txt
$ git commit -m.
[master (root-commit) c6f195e] .
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
$ git -c core.autocrlf=true -c core.eol=crlf archive --format=tar HEAD
> test.tar
$ tar xvf test.tar
test.txt
$ od -c test.txt
0000000   f   o   o  \r  \n   b   a   r  \r  \n
0000012

This leaves me a bit puzzled. On Linux, I can override the default
new-line style CRLF for git-archive, but I can't override it to LF on
Windows?

I expected it to work because sha1_file_to_archive calls
convert_to_working_tree. I've tried stepping through the code, but I
don't quite understand where it goes wrong. Or even how the code is
supposed to work :P

Does anyone have any clue what's going on? I'm running with the
current master, git version 1.7.3.3.585.g74f6e.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-11 19:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15 22:32 git-archive and core.eol Erik Faye-Lund
2011-01-08 13:35 ` René Scharfe
2011-01-08 17:28   ` Erik Faye-Lund
2011-01-09 12:52     ` René Scharfe
2011-01-10 12:11       ` Erik Faye-Lund
2011-01-10 13:00         ` Erik Faye-Lund
2011-01-11 19:24           ` René Scharfe

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).