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

Re: [PATCH (BUGFIX)] Respect core.autocrlf in combined diff

From
Alexander Gavrilov <angavrilov@gmail.com>
Date
Aug 24, 2008, 09:21 UTC
Message-ID
<200808241321.58791.angavrilov@gmail.com>
In-Reply-To
<7vy72nurw0.fsf@gitster.siamese.dyndns.org>
On Sunday 24 August 2008 05:24:31 Junio C Hamano wrote:
Show 15 quoted lines
> Alexander Gavrilov <angavrilov@gmail.com> writes:
> 
> > 		...
> > 		git commit -m aaa
> > 		git config core.autocrlf true
> > 		git merge b
> >
> > 	Then look at the output of git diff.
> 
> Come to think of it, this test sequence is totally bogus, isn't it?
> 
> After making the "aaa" commit, you change core.autocrlf setting, which
> means that at that point your work tree is invalid and needs to be checked
> out with the right crlf.
> 

Yes, it is more correct to reset after changing that parameter, but since merge overwrites the file anyway, I took a shortcut. I first noticed the problem on Windows, where autocrlf was turned on from the beginning.

By the way, am I right that currently the only way to get properly CRLFed versions of all stages is to do something like this:

mv -f $path "$path.BACKUP" git checkout-index -f --stage=1 $path mv -f $path "$path.BASE" git checkout-index -f --stage=2 $path mv -f $path "$path.LOCAL" git checkout-index -f --stage=3 $path mv -f $path "$path.REMOTE" cp -f "$path.BACKUP" $path

git-mergetool does it like this, but it produces LF files:
    base_present   && git cat-file blob ":1:$prefix$MERGED" >"$BASE" 2>/dev/null
    local_present  && git cat-file blob ":2:$prefix$MERGED" >"$LOCAL" 2>/dev/null
    remote_present && git cat-file blob ":3:$prefix$MERGED" >"$REMOTE" 2>/dev/null
Alexander
Previous: Junio C Hamano
Message 4 of 4 in “Respect core.autocrlf in combined diff”
  1. Respect core.autocrlf in combined diffAlexander Gavrilov, Aug 23, 2008
  2. Junio C HamanoAug 24, 2008
  3. Junio C HamanoAug 24, 2008
  4. Alexander GavrilovAug 24, 2008

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.