From: "Torsten Bögershausen" <tboegi@web.de>
To: Vladimir Nikishkin <lockywolf@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: core.safecrlf warning is confusing[improvement suggestion?]
Date: Tue, 21 Nov 2017 17:18:24 +0100 [thread overview]
Message-ID: <20171121161824.GA13548@tor.lan> (raw)
In-Reply-To: <CA+A2iZaLZCMvyb3nbcn=ofVGAPeW2_wRhjOeRRu5q01LuV++Gw@mail.gmail.com>
On Tue, Nov 21, 2017 at 01:18:30PM +0800, Vladimir Nikishkin wrote:
> Hello, everyone.
>
> I have the following question.
>
> So I have a fresh git repository after git init, on Windows.
>
> core.autocrlf is true explicitly, and core.safecrlf is true implicitly.
>
> I want to have LF line endings in the repository and CRLF endings in
> the working copy. (Because I use windows-exclusive tools to develop.)
Side note: If you ever want to push your repository somewhere,
it would be good practice to have a .gitattributes file:
echo "* text=auto" >>.gitattributes
git add .gitattributes
git commit -m "add .gitattributes"
This can be useful if the repo is pulled to a person who has
core.autocrlf=false, if case [s]he is creating files with CRLF in the
worktree.
>
> But for start I have my code with LF endings, because I got it from a
> fellow developer, who develops on UNIX, with LF line endings.
>
> What I expect git to do:
> Commit files as is (LF), keep my files in the working directory with
> LF, but after issuing 'git checkout master' have them converted to
> CRLF (since this is a checkout procedure).
>
> So I put the source in the working directory and tell git to make
>
> git diff --stat
As Junio pointed out, it is probably not git diff saying this ?
Typically "git add" gives the warning.
>
> and I see the (ambiguous) warnings:
>
> 'warning: LF will be replaced by CRLF in filename.m.
> The file will have its original line endings in you working directory.'
>
> How I read them: "even though you have core.autocrlf=true, LF will be
> replaced by CRLF and the repository will store CRLF files. However,
> after you checkout them again, the CRLFs will be converted back to
> LF(because the files will have original line endings in the working
> directory.)"
>
> I feel like it's the opposite of what is actually happening.
>
> So, would it make sense to change the warning message to? :
>
> 'warning: When you next checkout this commit, your code will have CRLF
> line endings. However, right now your files will not be altered.'
I could agree.
Do you want to send a patch for this ?
(The code to be changd is in convert.c, plus some test cases)
>
> --
> Yours sincerely, Vladimir Nikishkin
next prev parent reply other threads:[~2017-11-21 16:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 5:18 core.safecrlf warning is confusing[improvement suggestion?] Vladimir Nikishkin
2017-11-21 5:44 ` Junio C Hamano
2017-11-21 5:49 ` Junio C Hamano
2017-11-21 16:18 ` Torsten Bögershausen [this message]
2017-11-22 2:01 ` Junio C Hamano
2017-11-22 14:56 ` Torsten Bögershausen
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=20171121161824.GA13548@tor.lan \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
--cc=lockywolf@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).