Run git at server

I want a plugin which would prevent build from starting if a specified commit is not an ancestor of the head. For initial version, I would be happy if it's working at least with git and server-side checkout.

So, I'm already inherited from `BuildServerAdapter`, overrided `buildStarted` and figured out how to get commit hash from `SRunningBuild`. My next step is to invoke `git merge-base --is-ancestor $requiredAncestorSha HEAD` and kill the build if the exit code is 1.

I can't find a way to get the repo directory. I tried the one I found in git-teamcity plugin, but the property is null in my case.

So, two questions:

  1. How can I get the path from `SRunningBuild` object?
  2. Is my plan seems reasonable, or is there a better way? For example, it seems weird to search for git exe by myself -- TC should already know where it is.

Please sign in to leave a comment.