* Another core.safecrlf behavor with git diff/git status
@ 2013-06-24 16:37 Yann Droneaud
2013-06-24 16:43 ` Yann Droneaud
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Yann Droneaud @ 2013-06-24 16:37 UTC (permalink / raw)
To: git
Hi,
I'm still trying to use .gitattributes "text" flag with CRLF line ending
files
under Linux.
I'm surprised about the interaction between the index and the working
directory,
more specificaly about the interaction between git diff and git status:
$ git init
Initialized empty Git repository in /home/ydroneaud/tmp/.git/
$ echo "test text" > .gitattributes
$ git add .gitattributes
$ git commit -m ".gitattributes"
[master (root-commit) 67c2a06] attrib
1 file changed, 1 insertion(+)
create mode 100644 .gitattributes
$ printf "One\r\nLine\r\n" > test
$ git add test
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working
directory.
$ git commit -m "test"
[master 8b06aed] test
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working
directory.
1 file changed, 2 insertions(+)
create mode 100644 test
$ git diff
# <git diff report nothing>
$ touch test
$ git diff
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working
directory.
$ git diff # <= twice
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working
directory.
$ git status
# On branch master
nothing to commit, working directory clean
$ git diff
# <git diff report nothing>
- Why git diff does not always report the CRLF/LF mismatch ?
- Why git status does not report about the CRLF/LF mismatch before
updating the index:
it silently hide the CRLF/LF warning.
git add, git commit report the warning. git status should probably do
the same.
Regards.
--
Yann Droneaud
OPTEYA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Another core.safecrlf behavor with git diff/git status
2013-06-24 16:37 Another core.safecrlf behavor with git diff/git status Yann Droneaud
@ 2013-06-24 16:43 ` Yann Droneaud
2013-06-24 16:55 ` Junio C Hamano
2013-06-24 17:02 ` Yann Droneaud
2 siblings, 0 replies; 5+ messages in thread
From: Yann Droneaud @ 2013-06-24 16:43 UTC (permalink / raw)
To: git; +Cc: git-owner
Le 24.06.2013 18:37, Yann Droneaud a écrit :
> I'm still trying to use .gitattributes "text" flag with CRLF line
> ending files
> under Linux.
>
> I'm surprised about the interaction between the index and the working
> directory,
> more specificaly about the interaction between git diff and git status:
[...]
> - Why git diff does not always report the CRLF/LF mismatch ?
>
> - Why git status does not report about the CRLF/LF mismatch before
> updating the index:
> it silently hide the CRLF/LF warning.
> git add, git commit report the warning. git status should probably
> do the same.
Can this problem be related to the rebase failure I've described in
thread
"git rebase fail with CRLF conversion" [1][2][3] ?
1. <fb20a7d711fdd218f58f1f2090b1c515@meuh.org>
2. <http://thread.gmane.org/gmane.comp.version-control.git/228613>
3. <http://marc.info/?l=git&m=137182211414404&w=2>
Regards.
--
Yann Droneaud
OPTEYA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Another core.safecrlf behavor with git diff/git status
2013-06-24 16:37 Another core.safecrlf behavor with git diff/git status Yann Droneaud
2013-06-24 16:43 ` Yann Droneaud
@ 2013-06-24 16:55 ` Junio C Hamano
2013-06-25 8:52 ` Yann Droneaud
2013-06-24 17:02 ` Yann Droneaud
2 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2013-06-24 16:55 UTC (permalink / raw)
To: Yann Droneaud; +Cc: git
Yann Droneaud <ydroneaud@opteya.com> writes:
> - Why git diff does not always report the CRLF/LF mismatch ?
Most likely because you are telling safecrlf not to error out but
just warn, and then you are not fixing the cause of the warning? So
diff would say "Ok, you must know what you are doing, so I trust
what is in the index", perhaps?
> - Why git status does not report about the CRLF/LF mismatch before
> updating the index:
My suspicion is the same as "diff".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Another core.safecrlf behavor with git diff/git status
2013-06-24 16:37 Another core.safecrlf behavor with git diff/git status Yann Droneaud
2013-06-24 16:43 ` Yann Droneaud
2013-06-24 16:55 ` Junio C Hamano
@ 2013-06-24 17:02 ` Yann Droneaud
2 siblings, 0 replies; 5+ messages in thread
From: Yann Droneaud @ 2013-06-24 17:02 UTC (permalink / raw)
To: git
Le 24.06.2013 18:37, Yann Droneaud a écrit :
> I'm still trying to use .gitattributes "text" flag with CRLF line
> ending files
> under Linux.
>
> I'm surprised about the interaction between the index and the working
> directory,
> more specificaly about the interaction between git diff and git status:
[...]
> - Why git diff does not always report the CRLF/LF mismatch ?
>
> - Why git status does not report about the CRLF/LF mismatch before
> updating the index:
> it silently hide the CRLF/LF warning.
> git add, git commit report the warning. git status should probably
> do the same.
>
One last try for today, still under Linux, with git 1.8.1.4:
$ git init
Initialized empty Git repository in
/home/ydroneaud/src/tmp/onemore/work1/.git/
$ git commit --allow-empty -m "root"
[master (root-commit) 89c2ff9] root
$ CRLF="\r\n"
$ printf "Hello World 1${CRLF}Hello World 2${CRLF}Hello World
3${CRLF}Hello World 4" > test
$ git add test
$ git commit -m "test"
[master 36d4628] test
1 file changed, 4 insertions(+)
create mode 100644 test
$ echo "test text" > .gitattributes
$ git add .gitattributes
$ git commit -m ".gitattributes"
[master 3b9f3cc] .gitattributes
1 file changed, 1 insertion(+)
create mode 100644 .gitattributes
$ git diff # print nothing
$ git status
# On branch master
nothing to commit, working directory clean
$ touch test
$ git diff
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working
directory.
diff --git a/test b/test
index b043836..63ba10f 100644
--- a/test
+++ b/test
@@ -1,4 +1,4 @@
-Hello World 1
-Hello World 2
-Hello World 3
+Hello World 1
+Hello World 2
+Hello World 3
Hello World 4
\ No newline at end of file
- commiting .gitattributes should have trigger a warning about CRLF
conversion
- doing git diff after commiting .gitattributes should have reported the
warning about CRLF/LF.
I dislike complaining all the time about such unusual corner cases, I
apologize not having patches
to provides to Git to try to "fix"/improve this.
Regards.
--
Yann Droneaud
OPTEYA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Another core.safecrlf behavor with git diff/git status
2013-06-24 16:55 ` Junio C Hamano
@ 2013-06-25 8:52 ` Yann Droneaud
0 siblings, 0 replies; 5+ messages in thread
From: Yann Droneaud @ 2013-06-25 8:52 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
Le 24.06.2013 18:55, Junio C Hamano a écrit :
> Yann Droneaud <ydroneaud@opteya.com> writes:
>
>> - Why git diff does not always report the CRLF/LF mismatch ?
>
> Most likely because you are telling safecrlf not to error out but
> just warn, and then you are not fixing the cause of the warning? So
> diff would say "Ok, you must know what you are doing, so I trust
> what is in the index", perhaps?
>
>> - Why git status does not report about the CRLF/LF mismatch before
>> updating the index:
>
> My suspicion is the same as "diff".
I'm ok with theses answers regarding the test case provided first:
the warning was emitted when the files were commited.
(But still I would like git diff/git status to behave the same regarding
the "index":
emit the warning and update the index,
I suppose it's not related to core.safecrlf but inner Git way of
working).
Could you have a look at the other test case I've sent later in this
thread / the rebase problem I've sent earlier in another thread.
Regards.
--
Yann Droneaud
OPTEYA
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-06-25 8:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-24 16:37 Another core.safecrlf behavor with git diff/git status Yann Droneaud
2013-06-24 16:43 ` Yann Droneaud
2013-06-24 16:55 ` Junio C Hamano
2013-06-25 8:52 ` Yann Droneaud
2013-06-24 17:02 ` Yann Droneaud
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).