Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-14 Thread Avery Pennarun
On Sun, Feb 13, 2011 at 9:21 PM, jd chima...@gmail.com wrote:
 On Feb 13, 8:52 pm, Abhishek Shadangi shada...@gmail.com wrote:
 That's because - git checkout will checkout the files from the git
 database, and will use your CRLF settings native to you OS and modify the
 files.

 Ok, so I turned off autocrlf and now 'git status' says that nothing
 has changed.

 I'm still somewhat puzzled.  I can see that with autocrlf turned on,
 some of my files
 might have undergone CRLF-ification.  But if so, shouldn't git
 recognize that the
 CRLFs were added (and would presumably be removed on commit)?

 Also, some of my files already had consistent usage of CRLF; why would
 those files
 be affected by autocrlf?

 Thanks for your continued help on this issue.  I'd like to gain a good
 enough
 understanding so that I don't shoot myself in the foot again ;-)

Basically git's autocrlf setting is buggy and always has been.  You
can sometimes munge it into working if you set it *before* checking
out of a repo, but if you set it on an already-checked-out repo, weird
things generally happen.

The git developers have put quite a bit of work into fixing it, but
unfortunately none of the core developers use Windows, thus none of
them have crlf problems.  The developers who *do* have crlf problems
learned to set the setting once and ignore it.  So the problems tend
not to get entirely fixed.

I did see some patches go by; maybe a newer version of git will fix
the problem though.

One common git crlf problem occurs when someone *not* using autocrlf
commits a file that contains crlf instead of lf line endings.  Then
when you checkout the file with autocrlf enabled, git gets confused.

The easiest thing to do is to just never use autocrlf mode; if all
your developers are on Windows anyway, you don't need to fix the crlf
problems anyhow.

Have fun,

Avery

-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-14 Thread Tekkub
Actually, CRLF isn't that big of an issue if everyone has their settings
correct (yes, that's a big if).  On windows it should be true, which is what
msysgit sets on install unless you change it.  On linux and OSX, though,
it's usually set to false, which is incorrect.  If it's not set to input,
OSX and linux users can introduce a CRLF'd files unintentionally.  No, it
won't happen if the file was generated on that OS directly, but external
files (downloaded libraries!) might have them.  True and input are the way
to go.

For more info on how to fix the CRLF issues see:
http://help.github.com/dealing-with-lineendings

Avery, it sounds like you have a direct line to the git devs, my suggestion
is that git automatically use true on windows and input on everything else
unless the user specifically overrides the autocrlf setting.  Right now it
defaults to false if it isn't set.  It's very rare for the line endings to
truly matter (i.e. a windows program imploding if it receives LF, like, say,
notepad)... so it's probably best to use smart defaults and let the user
disable it if it's a problem on a case by case basis.

On Mon, Feb 14, 2011 at 1:12 AM, Avery Pennarun apenw...@gmail.com wrote:

 On Sun, Feb 13, 2011 at 9:21 PM, jd chima...@gmail.com wrote:
  On Feb 13, 8:52 pm, Abhishek Shadangi shada...@gmail.com wrote:
  That's because - git checkout will checkout the files from the git
  database, and will use your CRLF settings native to you OS and modify
 the
  files.
 
  Ok, so I turned off autocrlf and now 'git status' says that nothing
  has changed.
 
  I'm still somewhat puzzled.  I can see that with autocrlf turned on,
  some of my files
  might have undergone CRLF-ification.  But if so, shouldn't git
  recognize that the
  CRLFs were added (and would presumably be removed on commit)?
 
  Also, some of my files already had consistent usage of CRLF; why would
  those files
  be affected by autocrlf?
 
  Thanks for your continued help on this issue.  I'd like to gain a good
  enough
  understanding so that I don't shoot myself in the foot again ;-)

 Basically git's autocrlf setting is buggy and always has been.  You
 can sometimes munge it into working if you set it *before* checking
 out of a repo, but if you set it on an already-checked-out repo, weird
 things generally happen.

 The git developers have put quite a bit of work into fixing it, but
 unfortunately none of the core developers use Windows, thus none of
 them have crlf problems.  The developers who *do* have crlf problems
 learned to set the setting once and ignore it.  So the problems tend
 not to get entirely fixed.

 I did see some patches go by; maybe a newer version of git will fix
 the problem though.

 One common git crlf problem occurs when someone *not* using autocrlf
 commits a file that contains crlf instead of lf line endings.  Then
 when you checkout the file with autocrlf enabled, git gets confused.

 The easiest thing to do is to just never use autocrlf mode; if all
 your developers are on Windows anyway, you don't need to fix the crlf
 problems anyhow.

 Have fun,

 Avery

 --
 You received this message because you are subscribed to the Google Groups
 GitHub group.
 To post to this group, send email to github@googlegroups.com.
 To unsubscribe from this group, send email to
 github+unsubscr...@googlegroups.comgithub%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/github?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-14 Thread jd
Given the conflicting recommendations on autocrlf, as well as the bugs
in git
for managing autocrlf, it sounds like there is no simple solution.
Given that I've
had problems with autocrlf, I'm going to turn it off and see if that
provides a
more stable solution.

Thanks for the comments.

-- jeff

-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-13 Thread John Collins

On 02/13/2011 03:28 PM, jd wrote:

I have a usb drive (flash drive, FAT32, Windows) with all sorts of
stuff, including a handful of git repositories.  I recently copied the
whole drive over to a newer usb drive.  I then went to one of the
repositories on the new driveand did a 'git status' and was told that
dozens of files had changed (but they really hadn't).  I know that
'git clone' is the proper way clone a repository, but why wouldn't a
copy work properly?


Probably because the dates have changed.

--
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-13 Thread jd
On Feb 13, 3:32 pm, John Collins jcoll...@cs.umn.edu wrote:

 Probably because the dates have changed.

I thought that git looked only at the contents of files.  Is the
timestamp (created, modified, and/or accessed) used also?

-- Jeff

-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-13 Thread Topher Fangio
Git also looks at file permissions. Any chance those changed?

Sent from my iPhone

On Feb 13, 2011, at 10:29 PM, jd chima...@gmail.com wrote:

 On Feb 13, 7:00 pm, Avery Pennarun apenw...@gmail.com wrote:
 Probably because the dates have changed.
 
 Usually that just makes 'git status' take extra long the first time,
 but get fast afterwards.  However, git on Windows is still a little
 funny, so maybe something like that is the cause.  More often it's
 crlf (line endings) related; did you happen to install a new copy of
 git or change your crlf default setting?
 
 It's possible that I changed the crlf default setting on one of my
 machines.
 
 If you run 'git checkout .' it should fix all the attributes after
 grinding away for a while.  (But watch out; if you really *have*
 changed any files, the changes will be lost.)
 
 I did a 'git checkout .'
 This did reduce the size of the 'changed' list significantly but there
 are still about a dozen files in the list (all of which are part of a
 .NET application project).
 
 -- jeff
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 GitHub group.
 To post to this group, send email to github@googlegroups.com.
 To unsubscribe from this group, send email to 
 github+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/github?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-13 Thread Avery Pennarun
On Sun, Feb 13, 2011 at 8:17 PM, jd chima...@gmail.com wrote:
 On Feb 13, 3:32 pm, John Collins jcoll...@cs.umn.edu wrote:
 Probably because the dates have changed.

 I thought that git looked only at the contents of files.  Is the
 timestamp (created, modified, and/or accessed) used also?

Yes.  If the timestamp changes, it knows it needs to look again at the
contents (which is much slower than just looking at the timestamp).

But if you really did change the crlf setting, that's almost certainly it.

Avery

-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-13 Thread jd
On Feb 13, 8:38 pm, Avery Pennarun apenw...@gmail.com wrote:

 But if you really did change the crlf setting, that's almost certainly it.

Ok.  Any idea why 'git checkout .' doesn't completely fix things?

-- jeff

-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-13 Thread Abhishek Shadangi
On Sun, Feb 13, 2011 at 11:50 PM, jd chima...@gmail.com wrote:

 On Feb 13, 8:38 pm, Avery Pennarun apenw...@gmail.com wrote:
 
  But if you really did change the crlf setting, that's almost certainly
 it.

 Ok.  Any idea why 'git checkout .' doesn't completely fix things?

 That's because - git checkout will checkout the files from the git
database, and will use your CRLF settings native to you OS and modify the
files.

-- jeff

 --
 You received this message because you are subscribed to the Google Groups
 GitHub group.
 To post to this group, send email to github@googlegroups.com.
 To unsubscribe from this group, send email to
 github+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/github?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.



Re: repository on a usb drive: copied to new drive, git status says files changed

2011-02-13 Thread jd
On Feb 13, 8:52 pm, Abhishek Shadangi shada...@gmail.com wrote:
 That's because - git checkout will checkout the files from the git
 database, and will use your CRLF settings native to you OS and modify the
 files.


Ok, so I turned off autocrlf and now 'git status' says that nothing
has changed.

I'm still somewhat puzzled.  I can see that with autocrlf turned on,
some of my files
might have undergone CRLF-ification.  But if so, shouldn't git
recognize that the
CRLFs were added (and would presumably be removed on commit)?

Also, some of my files already had consistent usage of CRLF; why would
those files
be affected by autocrlf?

Thanks for your continued help on this issue.  I'd like to gain a good
enough
understanding so that I don't shoot myself in the foot again ;-)

-- jeff

-- 
You received this message because you are subscribed to the Google Groups 
GitHub group.
To post to this group, send email to github@googlegroups.com.
To unsubscribe from this group, send email to 
github+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/github?hl=en.