From: Raman Gupta <rocketraman@fastmail.fm>
To: git@vger.kernel.org
Subject: Cygwin: Initial clone of repo containing .gitattributes has modified files
Date: Tue, 02 Jun 2009 08:47:34 -0400 [thread overview]
Message-ID: <4A251F66.2020809@fastmail.fm> (raw)
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
next reply other threads:[~2009-06-02 12:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-02 12:47 Raman Gupta [this message]
2009-06-02 15:50 ` Cygwin: Initial clone of repo containing .gitattributes has modified files Junio C Hamano
2009-06-02 15:56 ` Raman Gupta
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=4A251F66.2020809@fastmail.fm \
--to=rocketraman@fastmail.fm \
--cc=git@vger.kernel.org \
/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).