git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Alexander Litvinov <litvinov2004@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git-svn and auto crlf convertion.
Date: Tue, 30 Oct 2007 23:30:12 -0700	[thread overview]
Message-ID: <20071031063012.GA7798@muzzle> (raw)
In-Reply-To: <200710311049.43861.litvinov2004@gmail.com>

Alexander Litvinov <litvinov2004@gmail.com> wrote:
> Hello.
> 
> I have private svn repo with cpp source file in windows encoding (\r\n line 
> ending). I am tring to import it into git using git-svn. To make correct crlf 
> convertion I have made git svn init first then create 
> correct .git/info/attributes file and import repo using git svn fetch 
> command. But after import done I have strange situation: after git 
> checkout -f master git status show that almost all text files are modified.
> 
> As I understand situation git-svn put \r\n encoded files into repo without 
> convertng them to \n notation. git-checkout,git-status does the job right and 
> found 'modification' as far as they do the needed convertion.

Disclaimer: I'm not yet familiar with git attributes, having never used them.

> Is there any way to configure git-svn to make proper convertion or it is 
> broken and need to be fixed ?

As far as I can tell, SVN itself will store files with either LF or CRLF
in the repository when the file is created/updated and applies the line
conversion properties only to the working tree upon checkout.  This
means that the SVN repository can have a file that's LF but only
converted to CRLF when checked out and vice-versa.

git-svn takes and imports whatever raw data SVN gives it, ignoring any
properties set in SVN.  This is very important because SVN transfers
deltas for updating files, and if we change the base file; we can't
apply the delta SVN gives us.

If we converted the newlines in the raw data that SVN gave us, we would
need to store what format the original data we got from SVN was in
because of the delta.

What I assume svn does is it either:

a) reconverts before doing `svn update' or `svn switch'
b) it ignores newline-only changes when running `svn status' or `svn diff'

git (as far as I know, and hope) does neither.

-- 
Eric Wong

      reply	other threads:[~2007-10-31  6:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-31  4:49 git-svn and auto crlf convertion Alexander Litvinov
2007-10-31  6:30 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071031063012.GA7798@muzzle \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    --cc=litvinov2004@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).