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

Advices to imlement update hook

From
FMFrancis Moreau <francis.moro@gmail.com>
Date
Feb 9, 2011, 16:27 UTC
Message-ID
<AANLkTimdsCgNBAnJmnzGj3M3Q4RPb==fiWu1+ZQhWenO@mail.gmail.com>
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:
	<path>...
	    If provided, the results are limited to a subset of
	    files matching one of these prefix strings. i.e., file
	    matches /^<pattern1>|<pattern2>|.../ 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 <oldref> <newref> -- ^b || exit 1
but it doesn't work.
Could anybody give me some advices ?
Thanks
-- 
Francis
Next: Johannes Sixt
Message 1 of 6 in “Advices to imlement update hook”
  1. Francis MoreauFeb 9, 2011
  2. Johannes SixtFeb 9, 2011
  3. Johannes SixtFeb 9, 2011
  4. Francis MoreauFeb 9, 2011
  5. Jeff KingFeb 9, 2011
  6. Francis MoreauFeb 10, 2011

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.