* Cygwin: Initial clone of repo containing .gitattributes has modified files
@ 2009-06-02 12:47 Raman Gupta
2009-06-02 15:50 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Raman Gupta @ 2009-06-02 12:47 UTC (permalink / raw)
To: git
When a repository containing a .gitattributes file, which contains
other files with -crlf set is cloned on cygwin, with autocrlf = true,
the initial checkout of the working copy sets the line endings for the
-crlf files incorrectly (it ignores the .gitattributes, presumably
because it hasn't been checked out yet).
After the checkout has been done, git does correctly mark the files
with -crlf as "modified" and a simple reset --hard fixes it, but this
is very confusing for the user as the user has not done anything -- it
is git itself that has "modified" the file by not assigning the
correct line endings.
Reproduction recipe (on a cygwin binmode mount):
---------------------------------------------------
$ git --version
git version 1.6.1.2
$ git config --global core.autocrlf true
$ git config --global core.safecrlf true
$ mkdir temp.git; cd temp.git; git init
$ cat | unix2dos > file_dos
DOS
line
endings
^D
$ cat > file_unix
UNIX
line
endings
^D
$ cat > .gitattributes
.gitattributes -crlf
file_unix -crlf
^D
$ git add .gitattributes *
$ git commit -m "Test"
$ cd ..
$ git clone temp.git tempclone.git
$ cd tempclone.git
$ git status
...
# modified: .gitattributes
# modified: file_unix
...
---------------------------------------------------
Also, in a related issue, git on cygwin requires .gitattributes itself
to be included in .gitattributes, otherwise with safecrlf = true you get:
$ git add .gitattributes
fatal: LF would be replaced by CRLF in .gitattributes
(since .gitattributes created with a cygwin editor on a binmode mount
uses unix line endings)
Cheers,
Raman Gupta
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Cygwin: Initial clone of repo containing .gitattributes has modified files
2009-06-02 12:47 Cygwin: Initial clone of repo containing .gitattributes has modified files Raman Gupta
@ 2009-06-02 15:50 ` Junio C Hamano
2009-06-02 15:56 ` Raman Gupta
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2009-06-02 15:50 UTC (permalink / raw)
To: Raman Gupta; +Cc: git
Raman Gupta <rocketraman@fastmail.fm> writes:
> When a repository containing a .gitattributes file, which contains
> other files with -crlf set is cloned on cygwin, with autocrlf = true,
> the initial checkout of the working copy sets the line endings for the
> -crlf files incorrectly (it ignores the .gitattributes, presumably
> because it hasn't been checked out yet).
I think this is what v1.6.3-rc0~83^2~1 (Read attributes from the index
that is being checked out, 2009-03-13) was about.
I see you are using a version based on 1.6.1.2; isn't there a newer Cygwin
packaged one available?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Cygwin: Initial clone of repo containing .gitattributes has modified files
2009-06-02 15:50 ` Junio C Hamano
@ 2009-06-02 15:56 ` Raman Gupta
0 siblings, 0 replies; 3+ messages in thread
From: Raman Gupta @ 2009-06-02 15:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> Raman Gupta <rocketraman@fastmail.fm> writes:
>
>> When a repository containing a .gitattributes file, which contains
>> other files with -crlf set is cloned on cygwin, with autocrlf = true,
>> the initial checkout of the working copy sets the line endings for the
>> -crlf files incorrectly (it ignores the .gitattributes, presumably
>> because it hasn't been checked out yet).
>
> I think this is what v1.6.3-rc0~83^2~1 (Read attributes from the index
> that is being checked out, 2009-03-13) was about.
Thanks! I looked for the fix but didn't find any reference to it. Sorry.
> I see you are using
Actually, I use Linux -- its my coworkers that use cygwin! Bleh! :)
> a version based on 1.6.1.2; isn't there a newer Cygwin
> packaged one available?
Nope. That is the latest available as of this morning (at least in the
cygwin non-experimental branch).
Cheers,
Raman
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-02 16:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-02 12:47 Cygwin: Initial clone of repo containing .gitattributes has modified files Raman Gupta
2009-06-02 15:50 ` Junio C Hamano
2009-06-02 15:56 ` Raman Gupta
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).