hudson - run tests only when specific branch of code changes
I'm currently using Hudson to build and test python and c++ application, using git as a backend.
I was wondering if there's a good way to set "run test X only if the files 开发者_如何学Gounder the directory /foo/bar/baz has changed".
EDIT: Yes, I know git-hooks exist, but I was wondering how to figure out the delta between the last checked out revision and current revision.
You could use the Git hooks to look through each new commit after a push and determine if the files touched in those commits are a part of your specified directory.
EDIT: You could do something like this:
- Get the SHA of the last commit on the server (git rev-parse origin/master)
- Get the SHA of the last commit on your local branch (git rev-parse master)
- Use the two SHA's to do a 'git diff --name-only SHA1 SHA2' on the server to see if a commit hit your directory.
The --name-only will return only the changed files.
精彩评论