From: Johannes Sixt <j.sixt@viscovery.net>
To: Francis Moreau <francis.moro@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Advices to imlement update hook
Date: Wed, 09 Feb 2011 17:42:43 +0100 [thread overview]
Message-ID: <4D52C403.30501@viscovery.net> (raw)
In-Reply-To: <4D52C2FA.2030103@viscovery.net>
[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 don't you also want to inspect all commits between oldref and newref?
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.
-- Hannes
next prev parent reply other threads:[~2011-02-09 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-09 16:27 Advices to imlement update hook Francis Moreau
2011-02-09 16:38 ` Johannes Sixt
2011-02-09 16:42 ` Johannes Sixt [this message]
2011-02-09 16:51 ` Francis Moreau
2011-02-09 17:05 ` Jeff King
2011-02-10 13:24 ` Francis Moreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D52C403.30501@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=francis.moro@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).