Re: Advices to imlement update hook
From: Jeff King <hidden>
Date: 2016-06-15 22:50:32
On Wed, Feb 09, 2011 at 05:51:24PM +0100, Francis Moreau wrote:
quoted
quoted
quoted
git diff-tree <oldref> <newref> -- ^b || exit 1 but it doesn't work.git diff-tree --quiet <oldref> <newref> -- bshould do it; it sets the exit code.but does that work if a commit modify b/ and another directory ?
No, it just looks for commits that modified b. There is currently no way to specify a path to say "commit that did not modify b". You need to check the output of: git rev-list | git diff-tree --stdin -m --name-only which should list all paths modified by all commits. And then you can either blacklist or whitelist as appropriate (note that the names can be quoted; you might want to look at the "-z" option and do your list-checking in perl).
quoted
But don't you also want to inspect all commits between oldref and newref?Yes I want to inspect all commits in the range.
see above.
quoted
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.
Between the two endpoints. It won't even look at the commits in the middle, so as long as a later middle commit reverts the change of an earlier middle commit, the endpoints won't be affected. -Peff