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

Re: .gitignore, .gitattributes, .gitmodules, .gitprecious?,.gitacls? etc.

From
DKDmitry Kakurin <dmitry.kakurin@gmail.com>
Date
Sep 5, 2007, 08:06 UTC
Message-ID
<a1bbc6950709050106j137215obd7272b2a77c3b13@mail.gmail.com>
In-Reply-To
<20070904202326.GC3786@efreet.light.src>
On 9/4/07, Jan Hudec <bulb@ucw.cz> wrote:
Show 24 quoted lines
> On Tue, Aug 28, 2007 at 09:49:47 +0100, Johannes Schindelin wrote:
> > On Mon, 27 Aug 2007, Dmitry Kakurin wrote:
> >
> > > Here is the problem: we need to apply crlf attributes to a file. We
> > > could have .gitattributes both in the index and in the worktree.
> > > Which one do we use?
> > > In general .gitattributes file could be (U)nchanged, (C)hanged, (NP)
> > > NotPresent in each place.
> >
> > I do not see these cases.  You can have these cases, basically:
> >
> > - .gitattributes in worktree (then it does not matter what else we have),
> > - .gitattributes not in the worktree, but in the index (then that is taken)
> >
> > In the latter case, there could be conflicts _in_ .gitattributes, in which
> > case those .gitattributes are ignored.
> >
> > I do not see any problem with that.
>
> I do.
>
> IMNSHO it should be the other way around:
>  .gitattributes in index, than index version is used.
>  .gitattributes not in index, but in worktree, than that tree version is used.
Consider scenario when my commit #1 has .gitattributes:
    a.txt -nocrlf
and file a.txt
You pull it.
Now I make some changes to a.txt and realize that a.txt *is* a text
file now. I remove the entry from .gitattributes and notice that it
becomes empty. So I just remove .gitattributes file all together. It
becomes commit#2.
Now you pull it again. There *is* .gitattributes in local directory,
but index does not have it (because I've removed it on purpose). What
should happen?
I assert that since index does not have .gitattributes the one from
local directory should not be used.

Think about dedicated build machine scenario: I have a machine that always does sync + build. After every sync the local directory should always be identical to what-was-committed. With every commit 3 things could happen: .gitattributes could appear, disappear or change. In every case "build machine" must produce the exact copy of what-was-checked-in. The only way I see this happening is by using *only* index version of .gitattributes when files are moved index -> workspace.

A similar reasoning works for other direction (workplace -> index).
-- 
- Dmitry
Previous: Jan HudecNext: Junio C Hamano
Message 24 of 28 in “.gitignore, .gitattributes, .gitmodules, .gitprecious?, .gitacls? etc.”
  1. Dmitry KakurinAug 26, 2007
  2. Junio C HamanoAug 26, 2007
  3. Dmitry KakurinAug 26, 2007
  4. Junio C HamanoAug 26, 2007
  5. Dmitry KakurinAug 26, 2007
  6. Junio C HamanoAug 26, 2007
  7. Dmitry KakurinAug 26, 2007
  8. Petr BaudisAug 26, 2007
  9. Sam VilainAug 27, 2007
  10. David KastrupAug 27, 2007
  11. Sam VilainAug 27, 2007
  12. David KastrupAug 27, 2007
  13. Johannes SchindelinAug 27, 2007
  14. Johannes SchindelinAug 26, 2007
  15. martin f krafftAug 27, 2007
  16. Sergio CallegariAug 27, 2007
  17. David KastrupAug 27, 2007
  18. Petr BaudisAug 27, 2007
  19. Sergio CallegariAug 27, 2007
  20. Sergio CallegariAug 27, 2007
  21. Jan HudecSep 4, 2007
  22. .gitignore, .gitattributes, .gitmodules, .gitprecious?,.gitacls? etc.Dmitry Kakurin, Aug 27, 2007
  23. Jan HudecSep 4, 2007
  24. Dmitry KakurinSep 5, 2007
  25. Junio C HamanoSep 5, 2007
  26. Dmitry KakurinSep 5, 2007
  27. Jan HudecSep 5, 2007
  28. Jan HudecSep 4, 2007

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.