From: Robert Dailey <hidden> Date: 2018-08-27 14:10:48
Is there an 'auto' setting for the 'core.autocrlf' config? Reason I
ask is, I want that setting to be 'input' on linux but 'true' on
Windows. I have a global .gitconfig that I sync across different
platforms with Google Drive, and I hate to manage 2 copies of it on
each platform (linux and Windows). If there's some way to make the
line ending configuration the same between both, that would be
awesome.
Note that I do rely mostly on git attributes files for this, however
not all upstream repositories have one, and I don't always have
permission to create one there. In those cases, when it falls back to
configuration for line ending management, I want it to be
automatically configured based on the host platform.
Any advice is appreciated here. Unfortunately Google isn't much help
on this topic, Stack Overflow is a swamp full of different information
and none of it seems authoritative.
On Mon, Aug 27, 2018 at 09:10:33AM -0500, Robert Dailey wrote:
Is there an 'auto' setting for the 'core.autocrlf' config? Reason I
ask is, I want that setting to be 'input' on linux but 'true' on
Windows. I have a global .gitconfig that I sync across different
platforms with Google Drive, and I hate to manage 2 copies of it on
each platform (linux and Windows). If there's some way to make the
line ending configuration the same between both, that would be
awesome.
Note that I do rely mostly on git attributes files for this, however
not all upstream repositories have one, and I don't always have
permission to create one there.
How many repos do you look at, and how big is the "pain level" here?
Would it be possible to submit pull-requests ?
In those cases, when it falls back to
configuration for line ending management, I want it to be
automatically configured based on the host platform.
There is
git config core.eol native
But that is already the default, and it needs the 'text' attribute
to be set (or auto), the simplest solution is to have
* text=auto
in .gitattributes
Any advice is appreciated here. Unfortunately Google isn't much help
on this topic, Stack Overflow is a swamp full of different information
and none of it seems authoritative.
Out of interest, not to blame anybody:
Did you ever look at
https://git-scm.com/docs/git-config
The authoritative answer is in the Git project itself,
under Documentation/config.txt
In summary, if I understand you right,
the solution would be to use .gitattributes in every project.
HTH
On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen [off-list ref] wrote:
quoted
In those cases, when it falls back to
configuration for line ending management, I want it to be
automatically configured based on the host platform.
There is
git config core.eol native
An alternative is supporting conditional config includes based on
platform or host name, but I don't know if there are more use cases
like this to justify it.
--
Duy
From: Robert Dailey <hidden> Date: 2018-08-27 17:29:27
On Mon, Aug 27, 2018 at 10:53 AM Duy Nguyen [off-list ref] wrote:
On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen [off-list ref] wrote:
quoted
quoted
In those cases, when it falls back to
configuration for line ending management, I want it to be
automatically configured based on the host platform.
There is
git config core.eol native
An alternative is supporting conditional config includes based on
platform or host name, but I don't know if there are more use cases
like this to justify it.
To Torsten's comment: Yes, I've looked at git-config. it doesn't have
the answer to my question there, hence I posted on the mailing list.
To your point, eol being native doesn't matter if text=auto can't be
simulated. If there was a version of `autocrlf` that set `eol=native`
and `text=auto`, that would work as well. But the `true` setting sets
`text=auto` and `eol=crlf`.
Duy: There are more use cases I've run into, but they are not related to the OP:
* Different user email between machines (work vs personal)
* Different tooling on platform (e.g. `nano` on Ubuntu, Notepad++ on Windows)
Centralizing .gitconfig, especially when you have tons of aliases,
becomes more important. 95% of my .gitconfig is platform-agnostic, if
there was an `#ifdef` mechanism, per your suggestion, this would allow
a lot more flexibility. Maybe I should have worded my OP more in terms
of platform-specific configuration sections, instead of specifically
about autocrlf, since that's just one symptom of the real problem.
From: Andrei Rybak <hidden> Date: 2018-08-27 17:32:14
On 2018-08-27 17:52, Duy Nguyen wrote:
On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen [off-list ref] wrote:
quoted
quoted
In those cases, when it falls back to
configuration for line ending management, I want it to be
automatically configured based on the host platform.
An alternative is supporting conditional config includes based on
platform or host name, but I don't know if there are more use cases
like this to justify it.
How about just using unconditional includes?
global.gitconfig (synced across machines):
[include]
path = platform-specific.gitconfig
And two version of file named "platform-specific.gitconfig", which
are not synced, and include only code.autocrlf setting.
--
Best regards, Andrei R.
From: Andrei Rybak <hidden> Date: 2018-08-27 18:22:24
On 2018-08-27 19:32, Andrei Rybak wrote:
How about just using unconditional includes?
global.gitconfig (synced across machines):
[include]
path = platform-specific.gitconfig
And two version of file named "platform-specific.gitconfig", which
are not synced, and include only code.autocrlf setting.
Robert, in this setup you might also want (just for convenience)
to sync files "platform1.gitconfig" and "platform2.gitconfig", so
that they are available everywhere for editing and can be copied
into local version of platform-specific.gitconfig at any time.
From: brian m. carlson <hidden> Date: 2018-08-28 00:14:12
On Mon, Aug 27, 2018 at 07:32:08PM +0200, Andrei Rybak wrote:
On 2018-08-27 17:52, Duy Nguyen wrote:
quoted
On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen [off-list ref] wrote:
quoted
quoted
In those cases, when it falls back to
configuration for line ending management, I want it to be
automatically configured based on the host platform.
An alternative is supporting conditional config includes based on
platform or host name, but I don't know if there are more use cases
like this to justify it.
How about just using unconditional includes?
global.gitconfig (synced across machines):
[include]
path = platform-specific.gitconfig
And two version of file named "platform-specific.gitconfig", which
are not synced, and include only code.autocrlf setting.
There's actually a way to do this that works with older Git versions as
well: put global config in .gitconfig and per-system config in
.config/git/config. Or you can use some sort of script (say, a
Makefile) to install the proper values based on your system.
--
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
From: Jonathan Nieder <hidden> Date: 2018-08-30 04:54:11
Hi,
Robert Dailey wrote:
Is there an 'auto' setting for the 'core.autocrlf' config? Reason I
ask is, I want that setting to be 'input' on linux but 'true' on
Windows.
Others are exploring your question about the configuration language,
but I want to emphasize some other ramifications.
Why do we still have 'core.autocrlf'? Do 'core.eol' and related
settings take care of that need, or is autocrlf still needed? If
core.eol etc do not take care of this need, what should we do to get
them to?
Thanks, after having run into a few too many autocrlf-related messes,
Jonathan
From: Robert Dailey <hidden> Date: 2018-08-30 14:53:22
On Mon, Aug 27, 2018 at 12:32 PM Andrei Rybak [off-list ref] wrote:
On 2018-08-27 17:52, Duy Nguyen wrote:
quoted
On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen [off-list ref] wrote:
quoted
quoted
In those cases, when it falls back to
configuration for line ending management, I want it to be
automatically configured based on the host platform.
An alternative is supporting conditional config includes based on
platform or host name, but I don't know if there are more use cases
like this to justify it.
How about just using unconditional includes?
global.gitconfig (synced across machines):
[include]
path = platform-specific.gitconfig
And two version of file named "platform-specific.gitconfig", which
are not synced, and include only code.autocrlf setting.
I think I tried this some years back, but ended up ditching it because
when you modify settings via `git config --global`, it doesn't put
values in the right files. This is probably the best answer so far
though. It would still be great to have a mechanism that works within
1 file and is friendly to the git config command.
From: Robert Dailey <hidden> Date: 2018-08-30 14:58:07
On Wed, Aug 29, 2018 at 11:54 PM Jonathan Nieder [off-list ref] wrote:
Hi,
Robert Dailey wrote:
quoted
Is there an 'auto' setting for the 'core.autocrlf' config? Reason I
ask is, I want that setting to be 'input' on linux but 'true' on
Windows.
Others are exploring your question about the configuration language,
but I want to emphasize some other ramifications.
Why do we still have 'core.autocrlf'? Do 'core.eol' and related
settings take care of that need, or is autocrlf still needed? If
core.eol etc do not take care of this need, what should we do to get
them to?
Thanks, after having run into a few too many autocrlf-related messes,
Jonathan
From my perspective, the confusion is due to the evolution of the
feature. There's multiple ways to control EOL handling but most of it
is legacy/backward compatibility, I think. core.autocrlf is a
fall-back for repos that do not have a .gitattributes. Because
.gitattributes is optional by design, I'm not sure if getting rid of
the config options is a good idea. But your point did make me think
about how `core.autocrlf = true` should probably be a system config
default for the Git for Windows project. The default for that value
should be platform-defined. That would make it automatically work the
way I want, and might solve a lot of the issues where people are
committing CRLF into repositories on Windows.
On Thu, Aug 30, 2018 at 09:57:52AM -0500, Robert Dailey wrote:
On Wed, Aug 29, 2018 at 11:54 PM Jonathan Nieder [off-list ref] wrote:
quoted
Hi,
Robert Dailey wrote:
quoted
Is there an 'auto' setting for the 'core.autocrlf' config? Reason I
ask is, I want that setting to be 'input' on linux but 'true' on
Windows.
Others are exploring your question about the configuration language,
but I want to emphasize some other ramifications.
Why do we still have 'core.autocrlf'? Do 'core.eol' and related
settings take care of that need, or is autocrlf still needed? If
core.eol etc do not take care of this need, what should we do to get
them to?
Thanks, after having run into a few too many autocrlf-related messes,
Jonathan
From my perspective, the confusion is due to the evolution of the
feature. There's multiple ways to control EOL handling but most of it
is legacy/backward compatibility, I think. core.autocrlf is a
fall-back for repos that do not have a .gitattributes. Because
.gitattributes is optional by design, I'm not sure if getting rid of
the config options is a good idea.
Good summary. My original plan was to try to "make obsolete"/retire
and phase out core.autocrlf completely.
However, since e.g. egit/jgit uses it
(they don't have support for .gitattributes at all) I am not sure if this
is a good idea either. Opinions are welcome.
But your point did make me think
about how `core.autocrlf = true` should probably be a system config
default for the Git for Windows project. The default for that value
should be platform-defined. That would make it automatically work the
way I want, and might solve a lot of the issues where people are
committing CRLF into repositories on Windows.
Unless I am wrong, that had been the default a long time ago:
Git for Windows (at that time msysgit) had core.autocrlf=true
by default.
While this is a good choice for many repos, some people prefer
core.autocrlf=input.
Others just commit files for Windows-based repos with CRLF,
and the advantage is, that "git diff" doesn't show "^M" somewhere.
I allways encourage people to set up a .gitattributes file.
Does anybody thinks that we can make core.autocrlf obsolete ?
From: Randall S. Becker <hidden> Date: 2018-08-30 19:10:37
On August 30, 2018 2:57 PM, Torsten Bögershausen wrote:
On Thu, Aug 30, 2018 at 09:57:52AM -0500, Robert Dailey wrote:
quoted
On Wed, Aug 29, 2018 at 11:54 PM Jonathan Nieder [off-list ref]
wrote:
quoted
quoted
Hi,
Robert Dailey wrote:
quoted
Is there an 'auto' setting for the 'core.autocrlf' config? Reason
I ask is, I want that setting to be 'input' on linux but 'true' on
Windows.
Others are exploring your question about the configuration language,
but I want to emphasize some other ramifications.
Why do we still have 'core.autocrlf'? Do 'core.eol' and related
settings take care of that need, or is autocrlf still needed? If
core.eol etc do not take care of this need, what should we do to get
them to?
Thanks, after having run into a few too many autocrlf-related
messes, Jonathan
From my perspective, the confusion is due to the evolution of the
feature. There's multiple ways to control EOL handling but most of it
is legacy/backward compatibility, I think. core.autocrlf is a
fall-back for repos that do not have a .gitattributes. Because
.gitattributes is optional by design, I'm not sure if getting rid of
the config options is a good idea.
Good summary. My original plan was to try to "make obsolete"/retire and
phase out core.autocrlf completely.
However, since e.g. egit/jgit uses it
(they don't have support for .gitattributes at all) I am not sure if this
is a good
idea either. Opinions are welcome.
quoted
But your point did make me think
about how `core.autocrlf = true` should probably be a system config
default for the Git for Windows project. The default for that value
should be platform-defined. That would make it automatically work the
way I want, and might solve a lot of the issues where people are
committing CRLF into repositories on Windows.
Unless I am wrong, that had been the default a long time ago:
Git for Windows (at that time msysgit) had core.autocrlf=true by default.
While this is a good choice for many repos, some people prefer
core.autocrlf=input.
Others just commit files for Windows-based repos with CRLF, and the
advantage is, that "git diff" doesn't show "^M" somewhere.
I allways encourage people to set up a .gitattributes file.
Does anybody thinks that we can make core.autocrlf obsolete ?
The last time I checked, EGit does not set this by default. ECLIPSE Oxygen
3A/EGit-JGit 5.0.1, when running on Windows, creates core.filemode=false,
core.logallrefupdates=true, repositoryformatversion=0, symlinks=false. Some
SourceTree versions that predate the newer SourceTreeApp are somewhat stuck
on older embedded versions of git, but that may not be relevant. Personally,
I would seriously like to drop core.autocrlf and just have everyone on LF
EOL characters. I get frequently burnt by this despite knowing better.
Cheers,
Randall
-- Brief whoami:
NonStop developer since approximately 211288444200000000
UNIX developer since approximately 421664400
-- In my real life, I talk too much.
From: Jonathan Nieder <hidden> Date: 2018-08-31 03:29:46
Hi,
Torsten Bögershausen wrote:
My original plan was to try to "make obsolete"/retire
and phase out core.autocrlf completely.
However, since e.g. egit/jgit uses it
(they don't have support for .gitattributes at all) I am not sure if this
is a good idea either.
From: Randall S. Becker <hidden> Date: 2018-08-31 11:57:16
On August 30, 2018 11:29 PM, Jonathan Nieder wrote:
Torsten Bögershausen wrote:
quoted
My original plan was to try to "make obsolete"/retire and phase out
core.autocrlf completely.
However, since e.g. egit/jgit uses it
(they don't have support for .gitattributes at all) I am not sure if
this is a good idea either.
On Fri, Aug 31, 2018 at 07:57:04AM -0400, Randall S. Becker wrote:
On August 30, 2018 11:29 PM, Jonathan Nieder wrote:
quoted
Torsten Bögershausen wrote:
quoted
My original plan was to try to "make obsolete"/retire and phase out
core.autocrlf completely.
However, since e.g. egit/jgit uses it
(they don't have support for .gitattributes at all) I am not sure if
this is a good idea either.