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

Re: Advices to imlement update hook

From
FMFrancis Moreau <francis.moro@gmail.com>
Date
Feb 9, 2011, 16:51 UTC
Message-ID
<AANLkTik=Xw3b1i-AranJtfngOsfLvEDSzrMq3jKTy-Yy@mail.gmail.com>
In-Reply-To
<4D52C403.30501@viscovery.net>
On Wed, Feb 9, 2011 at 5:42 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 22 quoted lines
> [Sorry, sent too early - fat fingers :-(]
>
> Am 2/9/2011 17:38, schrieb Johannes Sixt:
>> 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.
> ...
>>> I also tried:
>>>
>>>    git diff-tree <oldref> <newref> -- ^b || exit 1
>>>
>>> but it doesn't work.
>>
>>   git diff-tree --quiet <oldref> <newref> -- b
>
> should do it; it sets the exit code.
but does that work if a commit modify b/ and another directory ?
> But don't you also want to inspect all commits between oldref and newref?
Yes I want to inspect all commits in the range.
> Someone could have modified the directory, and then reverted the
> modification in a later commit. If these commits arrive in a single push,
> the above code wouldn't notice this.

I agree but I thought that git diff-tree would list all changes made between the 2 refs.

Thanks
-- 
Francis
Previous: Johannes SixtNext: Jeff King
Message 4 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.