From: Jonathan Nieder <jrnieder@gmail.com>
To: Walter Bright <boost@digitalmars.com>
Cc: git@vger.kernel.org
Subject: Re: noob user, want checkins to all be forced to LF terminated lines
Date: Sat, 31 Jul 2010 00:44:37 -0500 [thread overview]
Message-ID: <20100731054437.GD14425@burratino> (raw)
In-Reply-To: <i30bg7$50k$1@dough.gmane.org>
Hi again,
Some clarifications.
Walter Bright wrote:
> git is installed under Ubuntu, but I'll be checking in files that I
> edit on both Windows and Ubuntu, so the line endings will vary
> depending on which platform I last editted the file on. Hence, I
> want to force them all to be LF upon checkin.
"[core] autocrlf = input" would work. With this setting, the work
tree is considered sacred (i.e., not touched in any magical way at
all) but content checked in that looks like text is converted to
use LF.
Using .gitattributes you can override the autodetection (see
convert.c::is_binary) of text files.
>> [core]
>> eol = lf
>
> So this changes the file in the repository to lf only, but not in
> the worktree? That's what I want.
The opposite. This makes the file in the worktree use lf on
checkout, if it is known to be a text file.
On Linux it is a no-op. For files known to be text files, the version
checked in _always_ uses LF anyway. The setting "[core] eol = lf" is
just a way to turn off "[core] eol = crlf".
> In the tracked tree? The documentation:
>
> http://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_checking_out_and_checking_in
>
> says it goes in:
>
> $GIT_DIR/info/attributes, .gitattributes
>
> so I'm confused again. Does .gitattributes go in $GIT_DIR, or in
> $GIT_DIR/info ? And what if both of those files are there, which one
> 'wins' ?
Though I said "in the tracked tree", it is generally the file in the
worktree that counts. There can be .gitattributes files in any
subdirectory of the toplevel of the work tree.
.git/info/attributes is a place to put local attribute settings that
should not be tracked. It has higher precedence than the
.gitattributes files. As the gitattributes(5) page says:
git consults $GIT_DIR/info/attributes file (which has the
highest precedence), .gitattributes file in the same
directory as the path in question, and its parent
directories up to the toplevel of the work tree (the
further the directory that contains .gitattributes is
from the path in question, the lower its precedence).
>> If everyone for which you want these setting to take effect uses a
>> recent version of git, you can write “text” instead of “crlf” if
>> you prefer.
>
> git --version says I'm using 1.5.6.3
Not recent enough. :)
Actually versions before 1.7.2 do not have the "[core] eol"
configuration, either, so there is one less thing to worry about.
> A final question: where does the repository actually go (so I can
> back it up)?
The subdirectory .git of the top level of the worktree.
You can back up with "git clone" or "git bundle", but copying the
.git directory also works fine.
Regards,
Jonathan
next prev parent reply other threads:[~2010-07-31 5:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-31 4:23 noob user, want checkins to all be forced to LF terminated lines Walter Bright
2010-07-31 4:49 ` Jonathan Nieder
2010-07-31 5:14 ` Walter Bright
2010-07-31 5:39 ` Ilari Liusvaara
2010-07-31 5:45 ` Walter Bright
2010-07-31 5:57 ` Ilari Liusvaara
2010-07-31 6:24 ` Walter Bright
2010-07-31 15:12 ` David Aguilar
2010-07-31 5:44 ` Jonathan Nieder [this message]
2010-07-31 6:32 ` Walter Bright
2010-07-31 6:41 ` Ilari Liusvaara
2010-07-31 20:38 ` Jonathan Nieder
2010-07-31 20:51 ` Walter Bright
2010-08-03 23:56 ` Jay Soffian
2010-08-04 5:29 ` Will Palmer
2010-07-31 5:41 ` Miles Bader
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=20100731054437.GD14425@burratino \
--to=jrnieder@gmail.com \
--cc=boost@digitalmars.com \
--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).