Re: Advices to imlement update hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]