git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is git-am expected to honor core.sharedRepository?
@ 2020-12-01 15:23 Matheus Tavares Bernardino
  2020-12-01 17:58 ` Junio C Hamano
  2020-12-02 22:06 ` Is git-am expected to honor core.sharedRepository? Junio C Hamano
  0 siblings, 2 replies; 17+ messages in thread
From: Matheus Tavares Bernardino @ 2020-12-01 15:23 UTC (permalink / raw)
  To: git

Hi, everyone

I'm not very familiar with this setting, but to my understanding it
should only affect files in $GIT_DIR not $GIT_WORK_TREE, is that
correct? Nevertheless, apply and am (which uses apply) end up
adjusting the permissions of created directories based on the setting.
To give an example:

We first commit the directory 'd':
$ mkdir d
$ touch d/f
$ git add d
$ 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:
$ git format-patch -1
$ git reset --hard HEAD~
$ git config core.sharedRepository 0700
$ git am *.patch

The setting was honored by am:
$ ls -l
drwx--S--- 2 matheus matheus 60 dez  1 11:30 d

And if we delete 'd' and check it out again, the setting is ignored:
$ rm -rf d
$ git checkout d
$ ls -l
drwxr-xr-x 2 matheus matheus 60 dez  1 11:31 d

Is this expected?

If not, the place to be changed is probably the
safe_create_leading_directories() call in apply.c. This function
internally calls adjust_shared_perm() to modify the permissions
according to core.sharedRepository, so we could probably pass a flag
to skip this step. But this function has at least 15 callers, so
should we introduce a wrapper for the non-shared case, instead?

(For some background, I stumbled across this while considering using
safe_create_leading_directories() for a parallel-checkout patch. But
then I noticed it adjusts the directories' permissions based on the
setting and I was worried whether it could be user for checkout.)

Thanks,
Matheus

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-01-09 22:44 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 15:23 Is git-am expected to honor core.sharedRepository? Matheus Tavares Bernardino
2020-12-01 17:58 ` Junio C Hamano
2020-12-01 23:45   ` [PATCH] apply: don't use core.sharedRepository to create working tree files Matheus Tavares
2020-12-02  0:21     ` Junio C Hamano
2020-12-19 17:51     ` Adam Dinwoodie
2020-12-19 18:12       ` Junio C Hamano
2020-12-19 18:59         ` Adam Dinwoodie
2020-12-19 18:32       ` Achim Gratz
2020-12-19 19:57         ` Adam Dinwoodie
2020-12-19 21:01           ` Achim Gratz
2020-12-22 22:24             ` Adam Dinwoodie
2020-12-22 22:49               ` Matheus Tavares Bernardino
2020-12-23 11:44                 ` [PATCH] t4129: fix setfacl-related permissions failure Adam Dinwoodie
2021-01-09 15:06                   ` Matheus Tavares Bernardino
2021-01-09 22:43                     ` Junio C Hamano
2020-12-02 22:06 ` Is git-am expected to honor core.sharedRepository? Junio C Hamano
2020-12-03  1:44   ` Matheus Tavares Bernardino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).