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

Re: [PATCH v2 2/2] Handle more file writes correctly in shared repos

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 11, 2016, 17:06 UTC
Message-ID
<xmqqtwmkxcz3.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqio30yur4.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 52 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> On Fri, 8 Jan 2016, Junio C Hamano wrote:
>>
>>> I think it is correct not to touch this codepath in this patch,
>>> because of the above two reasons, but more simply and generally, it
>>> is correct not to touch this codepath because core.sharedRepository
>>> is not about working tree files, and .rej is a file you use in your
>>> working tree.
>>
>> I am happy to adjust the log message, but I am pretty certain that the
>> `core.sharedRepository` setting actually also affects the working tree. At
>> least in my hands, calling
>>
>> 	git clone -c core.sharedRepository=group . test-shared
>>
>> results in all of the working tree files being group-writable.
>
> Interesting.  I have a suspicion that "clone" does not honor the
> configuration given that way, though.
>
>  $ umask 077
>  $ git clone -c core.sharedRepository=group ~/w/git.git sharedtest
>  $ cd sharedtest
>  $ ls -l COPYING .git/index
>  -rw------- 1 jch eng 18765 Jan 11 07:43 COPYING
>  -rw------- 1 jch eng 272037 Jan 11 07:43 .git/index
>
> Notice that the permission bits in the working tree is correct, but
> in the resulting .git/ they are bogus, so from this we cannot
> clearly see the reason why COPYING is not group-readable is because
> the checkout codepath (write_entry(), I think) is correctly omitting
> the call to adjust_perm(), or simply the configuration is ignored
> during the clone.
>
> With a workaround to ensure that checkout happens definitely after
> the configuration gets in effect by doing config and pull/checkout
> as two separate steps:
>
>  $ rm -fr sharedtest
>  $ umask 077
>  $ git init sharedtest && cd sharedtest
>  $ git config core.sharedRepository group
>  $ git pull ~/w/git.git/ master
>  $ ls -l COPYING .git/index
>  -rw------- 1 jch eng 18765 Jan 11 07:48 COPYING
>  -rw-rw---- 1 jch eng 272037 Jan 11 07:48 .git/index
>
> we can see that the configuration affects only the $GIT_DIR/ files
> and not working tree.
>
> So you found a bug in clone, I think ;-)

Having said all that, the above does not mean that I'll refuse to consider changing the semantics of core.sharedRepository in a future major version bump by doing adjust_perm() for working tree files, which we have deliberately chosen not to do in the current code.

But that is not within the scope of the patch we are discussing, and I am not convinced it is a good idea (I haven't heard either sides of arguments), so based on the current design, I think "we don't do fopen_for_writing() for working tree files" is a valid justification that is short-and-sweet for this patch.

Previous: Junio C HamanoNext: Johannes Schindelin
Message 35 of 45 in “commit: ensure correct permissions of the commit message”
  1. commit: ensure correct permissions of the commit messageJohannes Schindelin, Dec 19, 2015
  2. Jeff KingDec 20, 2015
  3. Johannes SchindelinDec 20, 2015
  4. Torsten BögershausenDec 20, 2015
  5. Johannes SchindelinDec 30, 2015
  6. Junio C HamanoDec 21, 2015
  7. Jeff KingDec 21, 2015
  8. Junio C HamanoDec 21, 2015
  9. Johannes SchindelinDec 30, 2015
  10. Junio C HamanoDec 30, 2015
  11. Johannes SchindelinJan 1, 2016
  12. Junio C HamanoJan 4, 2016
  13. Johannes SchindelinJan 5, 2016
  14. Junio C HamanoJan 5, 2016
  15. Johannes SchindelinJan 6, 2016
  16. Jeff KingJan 6, 2016
  17. Johannes SchindelinJan 6, 2016
  18. SZEDER GáborJan 15, 2016
  19. Junio C HamanoJan 15, 2016
  20. Johannes SchindelinJan 15, 2016
  21. SZEDER GáborJan 15, 2016
  22. Johannes SchindelinJan 15, 2016
  23. 0/2 Correctly handle transient files in shared repositoriesJohannes Schindelin, Jan 6, 2016
  24. 1/2 commit: allow editing the commit message even in shared reposJohannes Schindelin, Jan 6, 2016
  25. Jeff KingJan 7, 2016
  26. Junio C HamanoJan 7, 2016
  27. 2/2 Handle more file writes correctly in shared reposJohannes Schindelin, Jan 6, 2016
  28. Jeff KingJan 7, 2016
  29. Johannes SchindelinJan 8, 2016
  30. Junio C HamanoJan 7, 2016
  31. Johannes SchindelinJan 8, 2016
  32. Junio C HamanoJan 8, 2016
  33. Johannes SchindelinJan 11, 2016
  34. Junio C HamanoJan 11, 2016
  35. Junio C HamanoJan 11, 2016
  36. 0/2 Correctly handle transient files in shared repositoriesJohannes Schindelin, Jan 11, 2016
  37. 1/2 commit: allow editing the commit message even in shared reposJohannes Schindelin, Jan 11, 2016
  38. 2/2 Handle more file writes correctly in shared reposJohannes Schindelin, Jan 11, 2016
  39. Jeff KingJan 11, 2016
  40. Junio C HamanoJan 11, 2016
  41. Junio C HamanoJan 11, 2016
  42. Jeff KingJan 11, 2016
  43. Junio C HamanoJan 11, 2016
  44. Jeff KingJan 11, 2016
  45. Johannes SchindelinJan 12, 2016

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.