git-svn and crlf

329 views
Skip to first unread message

Darren Syzling

unread,
Apr 11, 2008, 4:03:50 AM4/11/08
to msy...@googlegroups.com
I'm using the Git-preview20080301.exe and seen the recent discussions
regarding core.autocrlf default of true. So I understand the
recommendation of using LF within a git repository and on Windows
machines converting to crlf within the working copy.

How does this work with git-svn and msysgit and are there currently
issues here? I have a windows based svn repository, however whenever I
clone this repository line feeds are being converted. If I commit to
my local git repository and they are stored with LF endings what
happens when I git-svn dcommit? Currently it looks like LFs are being
pushed into the svn repository and my working copying is getting
confused whenever I clone an existing svn repo, claiming text files
have been modified - due to line ending changes.


Darren

Peter Harris

unread,
Apr 11, 2008, 10:47:16 AM4/11/08
to dsyz...@gmail.com, msy...@googlegroups.com
On Fri, Apr 11, 2008 at 4:03 AM, Darren Syzling wrote:
>
> I'm using the Git-preview20080301.exe and seen the recent discussions
> regarding core.autocrlf default of true. So I understand the
> recommendation of using LF within a git repository and on Windows
> machines converting to crlf within the working copy.
>
> How does this work with git-svn and msysgit and are there currently
> issues here?

Currently, git-svn doesn't work with autocrlf. The Right Thing to do
would be for git-svn to convert svn:eol-style properties into a
.gitattributes file in the repository. Patches Welcome.

For now, I manually turn off autocrlf for each of my git-svn repositories.

Peter Harris

Clifford Caoile

unread,
Apr 12, 2008, 8:05:02 AM4/12/08
to pe...@peter.is-a-geek.org, msy...@googlegroups.com
Peter Harris:

On Fri, Apr 11, 2008 at 11:47 PM, Peter Harris
<pe...@peter.is-a-geek.org> wrote:
> On Fri, Apr 11, 2008 at 4:03 AM, Darren Syzling wrote:
> > How does this work with git-svn and msysgit and are there currently
> > issues here?
> Currently, git-svn doesn't work with autocrlf. The Right Thing to do
> would be for git-svn to convert svn:eol-style properties into a
> .gitattributes file in the repository. Patches Welcome.

In the case that eol-style appears, I agree.

However can we assume that svn:eol-style is being used? IIRC, the svn
default config is auto-props == no and no file-name-patterns defined.
In other words, nothing is converted, bytes are bytes.

> For now, I manually turn off autocrlf for each of my git-svn repositories.

Just to confirm, do you do this?

> git svn clone repo-url wk
> rem OMG wk is autocrlf==true
> mkdir wk-no
> move wk\.git wk-no
> rmdir /s/q wk
> cd wk-no
> git config core.autocrlf false
> git checkout HEAD -f --

Best regards,
Clifford Caoile

Peter Harris

unread,
Apr 12, 2008, 11:20:05 AM4/12/08
to piy...@gmail.com, msy...@googlegroups.com
On Sat, Apr 12, 2008 at 8:05 AM, Clifford Caoile wrote:
>
> Peter Harris:
>
> On Fri, Apr 11, 2008 at 11:47 PM, Peter Harris
> <pe...@peter.is-a-geek.org> wrote:
>
> > Currently, git-svn doesn't work with autocrlf. The Right Thing to do
> > would be for git-svn to convert svn:eol-style properties into a
> > .gitattributes file in the repository. Patches Welcome.
>
> In the case that eol-style appears, I agree.

The absence of svn:eol-style is well defined in Subversion, and it
means autocrlf = false. This would (should?) be represented in the
generated .gitattributes file (probably as a line that reads "* -crlf"
before any other lines).

> However can we assume that svn:eol-style is being used? IIRC, the svn
> default config is auto-props == no and no file-name-patterns defined.
> In other words, nothing is converted, bytes are bytes.

Exactly.

> > For now, I manually turn off autocrlf for each of my git-svn repositories.
>
> Just to confirm, do you do this?
>
> > git svn clone repo-url wk
> > rem OMG wk is autocrlf==true
> > mkdir wk-no
> > move wk\.git wk-no
> > rmdir /s/q wk
> > cd wk-no
> > git config core.autocrlf false
> > git checkout HEAD -f --

All my active git repos are git-svn based, so to be perfectly honest, I do:
git config --global core.autocrlf false
git svn clone url wk

(Which is another little white lie - I actually use cron on a Linux
box to keep a git-svn mirror up do date, and use a script to set up a
usable clone of that, since "git svn clone" takes too long to finish).

The repository I use does use svn:eol-style, but my editors all grok
LF line endings, so there isn't any problem (unless I accidentally
insert CRLF line endings -- say, by using WinMerge between a git-svn
checkout and an svn checkout)

With your case, you could probably do (untested):


git svn clone repo-url wk

cd wk


rem OMG wk is autocrlf==true

git config core.autocrlf false
git reset --hard HEAD

Peter Harris

Reply all
Reply to author
Forward
0 new messages