Subject: Re: confused about preserved permissions

From: Jan Hudec <[email-masked]>
Date: Mon, 3 Sep 2007 20:59:16 +0200

On Thu, Aug 23, 2007 at 09:48:23 +0200, Benoit SIGOURE wrote:
> Hmm yes, that's right.
>
> Let's look at the problem from another point of view then: I want my 
> *working tree* to be group readable even though my umask is 066.  Would it 
> be possible to add a local config option in the .git repo to tell git that 
> it should create new file this way (exactly like core.sharedRepository but 
> core.sharedWorkingCopy or whatever).
>
> WDYT?

You need to change umask not just for git, but for your editor and compiler
when you are working in the shared work tree as well, no? So what about
teaching your *shell* to change it as appropriate?

In zsh if you define a function chpwd, it will be called whenever you change
current working directory. If you define it as:

chpwd() {
    # The / at the end is to make foo/* match path foo
    case `pwd`/ in
	/path/to/your/worktree/*) umask 002;;
	*) umask 066;;
    esac
}

would make any command (ie. git, editor and compiler/make/...) ran from the
shared worktree run with umask 002 (or whatever depending on permissions you
want there) and anything ran from anywhere else use your normal umask 066.

I don't use bash, but I am almost sure you can get a suitable hook there as
well. If nothing else I recall there is a way to run a function from prompt
expansion, which would do the trick.

-- 
						 Jan 'Bulb' Hudec <[email-masked]>