开发者

hudson - run tests only when specific branch of code changes

开发者 https://www.devze.com 2023-03-09 09:13 出处:网络
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

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:

  1. Get the SHA of the last commit on the server (git rev-parse origin/master)
  2. Get the SHA of the last commit on your local branch (git rev-parse master)
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消