git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Store autocrlf during init-db (was [msysGit] autocrlf problems with Git-preview20080301.exe)

From
Steffen Prohaska <prohaska@zib.de>
Date
Mar 23, 2008, 09:31 UTC
Message-ID
<alpine.OSX.1.00.0803230943500.7541@cougar>
In-Reply-To
<alpine.LSU.1.00.0803230310500.4353@racer.site>
On Sun, 23 Mar 2008, Johannes Schindelin wrote:
Show 26 quoted lines
> On Sat, 22 Mar 2008, Junio C Hamano wrote:
> 
> > 
> > Steffen Prohaska <prohaska@zib.de> writes:
> > 
> > >> I suppose autocrlf enabled by default could be useful for new 
> > >> repositories, but not for working with existing repositories.
> > >
> > > We changed the global default to a sane setting for cross-platform 
> > > projects to avoid such problems in the future.  This means that from 
> > > now on git will take care that any repository newly created will have 
> > > sane line endings (LF in the repository; and CRLF in the work tree if 
> > > checked out on Windows respectively LF if checked out on Unix).
> > 
> > I've always wondered why you guys used /etc/gitconfig instead of setting 
> > it in the templates (or a patch to git-init).
> > 
> > I was against the idea of /etc/gitconfig from the very beginning (even 
> > before msysgit existed) in git.git itself, but this is a very good 
> > example why /etc/gitconfig is a bad idea.  It affects _existing_ setups.
> > 
> > How about fixing msys port so that it sets the configuration when the 
> > user initializes a _new_ repository, without breaking repositories the 
> > user has been happily using?
> 
> Makes sense.
Hmm.  I am not convinced.

Setting autocrlf for every repository limits the user's options to override the default. Currently we provide a global default and the user can either override globally for all his repositories or on a per-repository basis. Hence, users can decide that they want autocrlf to never happen and can easily set this in ~/.gitconfig. If we stored autocrlf in every newly created repository, the user would need to override our default again and again for every new repository.

Maybe what we want is to conserve the setup that exists when a new repository is created. Changing autocrlf later is tricky because the work tree's line endings depend on the settings during checkout. Therefore, it makes sense to preserve the value of autocrlf that exists during the first checkout. In this regards autocrlf is different from, for example, author because author can be easily changed later without requiring any conversion of existing files in the work tree.

Patch follows.

Unfortunately the proposed change won't change the fact that existing msysgit setups still break. I still do not see an easy way to avoid this.

            Steffen
Next: Steffen Prohaska
Message 1 of 25 in “Store autocrlf during init-db (was [msysGit] autocrlf problems with Git-preview20080301.exe)”
  1. Steffen ProhaskaMar 23, 2008
  2. init-db: Store current value of autocrlfSteffen Prohaska, Mar 23, 2008
  3. Dmitry PotapovMar 24, 2008
  4. Johannes SchindelinMar 23, 2008
  5. Steffen ProhaskaMar 23, 2008
  6. Johannes SchindelinMar 23, 2008
  7. Steffen ProhaskaMar 23, 2008
  8. Johannes SchindelinMar 23, 2008
  9. Steffen ProhaskaMar 23, 2008
  10. Johannes SchindelinMar 23, 2008
  11. Steffen ProhaskaMar 23, 2008
  12. Johannes SchindelinMar 23, 2008
  13. Dmitry PotapovMar 23, 2008
  14. Johannes SchindelinMar 24, 2008
  15. Dmitry PotapovMar 24, 2008
  16. Johannes SchindelinMar 24, 2008
  17. Dmitry PotapovMar 24, 2008
  18. Introduce core.initHookJohannes Schindelin, Mar 24, 2008
  19. init: show "Reinit" message even in an (existing) empty repositoryJohannes Schindelin, Mar 24, 2008
  20. Junio C HamanoMar 25, 2008
  21. Johannes SchindelinMar 25, 2008
  22. Junio C HamanoMar 24, 2008
  23. Introduce core.initHookJohannes Schindelin, Mar 24, 2008
  24. Junio C HamanoMar 24, 2008
  25. Introduce core.initHookJohannes Schindelin, Mar 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.