From: Johannes Sixt Date: Wed, 09 Feb 2011 16:38:18 GMT Subject: Re: Advices to imlement update hook Message-ID: <4D52C2FA.2030103@viscovery.net> In-Reply-To: Am 2/9/2011 17:27, schrieb Francis Moreau: > Hi ! > > I'd like to restrict access to one of my repos: the project tracked by > it has several directories: a/ b/ c/ and I'd like to allow only > modifications happen in b/ directory. > > I'm planning to use git hooks, not sure which one I should use: if the > check should happen at the commit or push time or both. > > For now I'm going to use the update hook, so it will happen when pushing. > > Now the question is: what is the best way to do this ? > > I'm planning to use something equivalent to "git-diff-tree oldref > newref | { grep -v b || exit 1; }" but doesn't look like the best git > way. > > BTW, from the git-diff-tree manpage: > > ... > If provided, the results are limited to a subset of > files matching one of these prefix strings. i.e., file > matches /^||.../ Note that this > parameter does not provide any wildcard or regexp > features. > > What does it mean exactly ? what does 'pattern' word mean if wildcard > or regexp is not supported ? > I also tried: > > git diff-tree -- ^b || exit 1 > > but it doesn't work. git diff-tree --quiet -- b