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

Re: fast-import and core.autocrlf option

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 23, 2007, 03:45 UTC
Message-ID
<20070723034514.GZ32566@spearce.org>
In-Reply-To
<Pine.LNX.4.64.0707230039560.14781@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 10 quoted lines
> On Sun, 22 Jul 2007, Dmitry Kakurin wrote:
> 
> > It looks to me that CR/LF conversion does not happen during
> > fast-import even if I have core.autocrlf set to 'input'.
> > Is this a bug or is there a reason for that?
> 
> fast-import works on blobs only.  So it is expected.  Besides, it would 
> slow down fast-import tremendously if you wanted to introduce that 
> behaviour.  Therefore I suggest just rolling your own dos2unix instead of 
> trying to play cute games with fast-import.

Right, in fast-import we only process blobs as raw blobs. Its rare that we have a file path associated with the blob data at the time that we are actually processing the blob itself. E.g. applications can send us blobs up front, before they even start to send us commits and path information.

So if we were to offer the CRLF->LF conversion feature in fast-import it would need to be an option supplied at the time the 'data' command issued, rather than based upon the gitattributes system that is normally used for working tree operations.

It wouldn't be to difficult to add such an option to the data command, but I'm not going to be able to get around to it anytime soon. This might be an easy change for someone else to attempt if they were interested in some Git hacking. Should all be isolated to the cmd_data() routine in fast-import.c, and just needs to call crlf_to_git() in convert.c, which is uh, static. :-)

-- 
Shawn.
Previous: Johannes SchindelinNext: Junio C Hamano
Message 3 of 5 in “fast-import and core.autocrlf option”
  1. Dmitry KakurinJul 22, 2007
  2. Johannes SchindelinJul 22, 2007
  3. Shawn O. PearceJul 23, 2007
  4. Junio C HamanoJul 23, 2007
  5. Shawn O. PearceJul 23, 2007

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.