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

Re: Per file configurable eol-style transformations with Git?

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 21, 2009, 21:18 UTC
Message-ID
<m3tywnbmpj.fsf@localhost.localdomain>
In-Reply-To
<9ED0EB52C33C41209726C6F4DB7FC194@helium>
"Alexander Veit" <alexander.veit@gmx.net> writes:
Show 22 quoted lines
> we have projects that contain text files that need to
> have different end-of-line sequences, depending on the
> type of file, and depending on the operating system where
> they are checked out.
> 
> There are files that have
> 
>  - LF line breaks on each platform,
>  - CR LF line breaks on each platform, or
>  - either LF or CR LF line breaks, depending on the
>    platform's native end-of-line style.
> 
> With Subversion, the correct behaviour in checkouts, commits,
> diffs, or merges can easily be achieved by setting the appropriate
> svn:eol-style [*].
> 
> As I understand the Git documentation there's no such concept as a
> repository end-of-line style, or as an end-of-line transformation
> between repository and working copy.
> 
> So I wonder if it is possible to mimic Subversion's end-of-line handling
> with Git, especially for the svn:eol-style=native.

See `crlf` attribute, which can be set, unset, unspecified, set to "input", and used together with core.autocrlf ("true", "false", "input") and core.safecrlf. Attributes can be set per path (using globbing patterns) in .gitattributes file in tree, or in .git/info/attributes (per repository).

HTH
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Alexander VeitNext: Alexander Veit
Message 2 of 4 in “Per file configurable eol-style transformations with Git?”
  1. Alexander VeitNov 21, 2009
  2. Jakub NarebskiNov 21, 2009
  3. Alexander VeitNov 21, 2009
  4. Junio C HamanoNov 22, 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.