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

Re: Non-blob .gitmodules and .gitattributes

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 18, 2024, 20:14 UTC
Message-ID
<xmqqa5jiypmm.fsf@gitster.g>
In-Reply-To
<14349714-F8D1-4F7B-BB13-4FA39C6819DE@gmail.com>
Alexey Pelykh <alexey.pelykh@gmail.com> writes:
Show 6 quoted lines
>> But I'd also suspect that other non-POSIX platforms would see the error
>> at open(), and _would_ actually produce an error message. I seem to
>> recall running into this before with Windows, maybe?
>
> Is there an easy way to verify "what on Windows" part? I'd be happy to
> help, yet I'm not sure I got it right what to look for.

Create a .gitmodules and .gitattributes directory, "git add" it, and perform various operations that want to read them, probably. Even a simple "git diff" should try to consult the attribute system (e.g. because it wants to know if a path needs use custom function header regexp pattern). As Peff said, on Linux and probably on macOS, we will silently ignore such .gitattributes and that is what we want. On Windows we may see "cannot open" error reported and visible to the users.

Show 7 quoted lines
> Surely, reserved names are reserved for some reason. If there's a legit
> reason alike cost-to-support, having an objection would be dumb. Yet
> if supporting would turn out to be of an effort alike dropping the check
> then it would seem having that check brings no value.
>
> With that said, if those are reserved names, why .gitignore is not reserved?
> For consistency at least.

We do not bother with ".gitignore" since we see no security implications in that file. But other two whose name begin with ".git" do have some security implications (actually .gitattributes is designed not to have any, but .gitmodules certainly does), so we choose to inspect their sizes, contents, and types.

But that raises a few more questions.

What to do about our future needs that may conflict the needs of users who want to use names of their choice? If we declare that any name that begin with ".git" is reserved, there will be fewer issues, but do we want to and can we afford to?

Also what if we later find security implications in ".gitignore" files and decide to inspect their sizes, contents, and types? The current system not issuing a warning does not give users any guarantee that the future systems won't (even though we try hard to avoid introducing such backward incompatible changes, we are human, too, and we sometimes screw up).

Thanks.
Previous: Alexey PelykhNext: Jeff King
Message 6 of 17 in “Non-blob .gitmodules and .gitattributes”
  1. Alexey PelykhJun 14, 2024
  2. Junio C HamanoJun 14, 2024
  3. Alexey PelykhJun 14, 2024
  4. Jeff KingJun 18, 2024
  5. Alexey PelykhJun 18, 2024
  6. Junio C HamanoJun 18, 2024
  7. Jeff KingJun 18, 2024
  8. 0/4 .git{ignore,attributes} directories?Junio C Hamano, Jun 18, 2024
  9. 1/4 .gitignore: introduce GITIGNORE_FILE CPP macroJunio C Hamano, Jun 18, 2024
  10. 2/4 attr: notice and report read failure of .gitattributes filesJunio C Hamano, Jun 18, 2024
  11. Eric SunshineJun 19, 2024
  12. Junio C HamanoJun 19, 2024
  13. Eric SunshineJun 19, 2024
  14. Jeff KingJun 19, 2024
  15. Junio C HamanoJun 20, 2024
  16. 4/4 submodule: ignore .gitmodules that is not a regular fileJunio C Hamano, Jun 18, 2024
  17. 3/4 exclude: notice and report read failure of .gitignore filesJunio C Hamano, Jun 18, 2024

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.