Skip to contentSkip to conversation

convert crlf to eol on vendor branch overlay

DISCUSSION Neal Kreitzinger 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

My vendor gave me a tarball with all CRLF eol's. I'm using the vendor-branch overlay method (git ls-files -z | xargs -0 rm -f && tar -xvzf tarfile.tar.gz). How do I convert the eol's to LF?

I tried this:

vi .git/attributes
SRC/*/* text (convert these to LF eol on commit)

$ git config core.eol lf (convert "text" attr files to LF eol on checkout)
$ git add . -A
$ git commit -m'convert eol'  (should convert CRLF to LF)
$ git checkout otherbranch  (change worktree)
$ git checkout vendorbranch (checkout worktree from commit to get LF 
version)
$ git reset HEAD^  (remove commit but keep worktree LF version)
$ git diff (still CRLF)
$ git status (still show everything as modified due to CRLF)

v/r,
neal

#1 lore raw
Quoted 8 lines · Neal Kreitzinger

How do I convert the eol's to LF?

I tried this:

vi .git/attributes
SRC/*/* text (convert these to LF eol on commit)

$ git config core.eol lf (convert "text" attr files to LF eol on checkout)

Instead, how about something like:

  $ git ls-files -z | xargs -0 perl -p -i -e 's/\r$//'

and then:

Quoted 2 lines
$ git add . -A
$ git commit -m'convert eol'  (should convert CRLF to LF)

?

#2 lore raw
Quoted 13 lines · Junio C Hamano
Quoted 8 lines · Neal Kreitzinger

How do I convert the eol's to LF?

I tried this:

vi .git/attributes
SRC/*/* text (convert these to LF eol on commit)

$ git config core.eol lf (convert "text" attr files to LF eol on checkout)

Instead, how about something like:

Quoted 8 lines
   $ git ls-files -z | xargs -0 perl -p -i -e 's/\r$//'

and then:

Quoted 2 lines
$ git add . -A
$ git commit -m'convert eol'  (should convert CRLF to LF)

?

That worked! Thanks!