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

Re: Is git-am expected to honor core.sharedRepository?

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 1, 2020, 17:58 UTC
Message-ID
<xmqqpn3tqugm.fsf@gitster.c.googlers.com>
In-Reply-To
<CAHd-oW4yHSTYr0Gwn60tu2c7VY=PJbSbg23Z5Bd_11Do-+juGA@mail.gmail.com>
Matheus Tavares Bernardino <matheus.bernardino@usp.br> writes:
> If not, the place to be changed is probably the
> safe_create_leading_directories() call in apply.c.
https://lore.kernel.org/git/xmqqziglaxj4.fsf@gitster.mtv.corp.google.com/

Calling adjust_shared_perm() on a path outside .git/ is a potential bug, as you found out, and definitely a bug if used on working tree files. We may want to share with only selected users in a group the contents of the repository (e.g. allow local cloning from us), while allowing daemon-ish tools to scan what is in the working tree files without letting them touch what is in the repository, for example; adjust_shared_perm() is meant for .git/ repository files and tightening working tree files' permissions using it would break such arrangement.

I think bugreport uses scld, but it may be used to drop cruft inside the working tree, but the files created are *not* to be "git add"ed, so the use case does not count as "if used on working tree files".

Show 8 quoted lines
> $ git commit -m d
> $ ls -l
> drwxr-xr-x 2 matheus matheus 60 dez  1 11:29 d
> ...
> Then we create a patch and use am to apply it:
> The setting was honored by am:
> $ ls -l
> drwx--S--- 2 matheus matheus 60 dez  1 11:30 d

Having said that, I know it can be argued both ways. If we want to protect .git/ contents in a certain way, it may be worth protecting the files in the working tree in the same way as well. But at least that is not the current rule is (even though as you found out we do have bugs).

Thanks.
Previous: Matheus Tavares BernardinoNext: Matheus Tavares
Message 2 of 17 in “Is git-am expected to honor core.sharedRepository?”
  1. Matheus Tavares BernardinoDec 1, 2020
  2. Junio C HamanoDec 1, 2020
  3. apply: don't use core.sharedRepository to create working tree filesMatheus Tavares, Dec 1, 2020
  4. Junio C HamanoDec 2, 2020
  5. Adam DinwoodieDec 19, 2020
  6. Junio C HamanoDec 19, 2020
  7. Adam DinwoodieDec 19, 2020
  8. Achim GratzDec 19, 2020
  9. Adam DinwoodieDec 19, 2020
  10. Achim GratzDec 19, 2020
  11. Adam DinwoodieDec 22, 2020
  12. Matheus Tavares BernardinoDec 22, 2020
  13. t4129: fix setfacl-related permissions failureAdam Dinwoodie, Dec 23, 2020
  14. Matheus Tavares BernardinoJan 9, 2021
  15. Junio C HamanoJan 9, 2021
  16. Junio C HamanoDec 2, 2020
  17. Matheus Tavares BernardinoDec 3, 2020

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.