Re: Automatic core.autocrlf?

2018-08-31 Thread Torsten Bögershausen
On Fri, Aug 31, 2018 at 07:57:04AM -0400, Randall S. Becker wrote:
> 
> On August 30, 2018 11:29 PM, Jonathan Nieder wrote:
> > 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.
> > 
> > Interesting.  [1] appears to have intended to add this feature.
> > Do you remember when it is that you tested?
> > 
> > Feel free to file bugs using [2] for any missing features.
> > 
> > [1] https://git.eclipse.org/r/c/60635
> > [2] https://www.eclipse.org/jgit/support/

Oh, (I thought that I digged into the source recently...)
Thanks for the clarification

> 
> My testing was done on EGit 5.0.1 yesterday, which does not provide a default 
> to core.autocrlf.
> 
> Cheers,
> Randall
> 

OK, then I assume that jgit supports .gitattributes now.
Just to ask a possibly stupid question: did anybody test it ?



RE: Automatic core.autocrlf?

2018-08-31 Thread Randall S. Becker


On August 30, 2018 11:29 PM, Jonathan Nieder wrote:
> 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.
> 
> Interesting.  [1] appears to have intended to add this feature.
> Do you remember when it is that you tested?
> 
> Feel free to file bugs using [2] for any missing features.
> 
> [1] https://git.eclipse.org/r/c/60635
> [2] https://www.eclipse.org/jgit/support/

My testing was done on EGit 5.0.1 yesterday, which does not provide a default 
to core.autocrlf.

Cheers,
Randall



Re: Automatic core.autocrlf?

2018-08-30 Thread Jonathan Nieder
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.

Interesting.  [1] appears to have intended to add this feature.
Do you remember when it is that you tested?

Feel free to file bugs using [2] for any missing features.

Thanks,
Jonathan

[1] https://git.eclipse.org/r/c/60635
[2] https://www.eclipse.org/jgit/support/


RE: Automatic core.autocrlf?

2018-08-30 Thread Randall S. Becker
On August 30, 2018 2:57 PM, Torsten Bögershausen wrote:
> On Thu, Aug 30, 2018 at 09:57:52AM -0500, Robert Dailey wrote:
> > On Wed, Aug 29, 2018 at 11:54 PM Jonathan Nieder 
> wrote:
> > >
> > > 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 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 ?

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 2112884442
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.





Re: Automatic core.autocrlf?

2018-08-30 Thread Torsten Bögershausen
On Thu, Aug 30, 2018 at 09:57:52AM -0500, Robert Dailey wrote:
> On Wed, Aug 29, 2018 at 11:54 PM Jonathan Nieder  wrote:
> >
> > 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 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 ?




Re: Automatic core.autocrlf?

2018-08-30 Thread Robert Dailey
On Wed, Aug 29, 2018 at 11:54 PM Jonathan Nieder  wrote:
>
> 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 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.


Re: Automatic core.autocrlf?

2018-08-30 Thread Robert Dailey
On Mon, Aug 27, 2018 at 12:32 PM Andrei Rybak  wrote:
>
> On 2018-08-27 17:52, Duy Nguyen wrote:
> > On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen  wrote:
> >>> 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.


Re: Automatic core.autocrlf?

2018-08-29 Thread Jonathan Nieder
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


Re: Automatic core.autocrlf?

2018-08-27 Thread brian m. carlson
On Mon, Aug 27, 2018 at 07:32:08PM +0200, Andrei Rybak wrote:
> On 2018-08-27 17:52, Duy Nguyen wrote:
> > On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen  wrote:
> >>> 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


signature.asc
Description: PGP signature


Re: Automatic core.autocrlf?

2018-08-27 Thread Andrei Rybak
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.



Re: Automatic core.autocrlf?

2018-08-27 Thread Andrei Rybak
On 2018-08-27 17:52, Duy Nguyen wrote:
> On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen  wrote:
>>> 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.


Re: Automatic core.autocrlf?

2018-08-27 Thread Robert Dailey
On Mon, Aug 27, 2018 at 10:53 AM Duy Nguyen  wrote:
>
> On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen  wrote:
> > > 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.


Re: Automatic core.autocrlf?

2018-08-27 Thread Duy Nguyen
On Mon, Aug 27, 2018 at 5:37 PM Torsten Bögershausen  wrote:
> > 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


Re: Automatic core.autocrlf?

2018-08-27 Thread Torsten Bögershausen
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



Automatic core.autocrlf?

2018-08-27 Thread Robert Dailey
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.