I am trying to write a merge-check hook that will take the list of changed files from a pull request and run a system command on them, effectively for deployment. I only want to deal with the changed files as the repositories I will be dealing with have thousands of files in a single directory. I would just write a bash script, but need the configurability the Stash UI provides.
I've got a demo hook running with atlas-run, so I've got the very basics going. I know that, were I on the command line, I could run 'git diff --name-only master..pullrequest_branch' for a list of changed files, which I can copy into a temp directory with 'git cat-file', 'git show', etc. Right now my bottle neck is just getting access to the repository.
First of all, should I be using system calls for the above actions, or can I get this information using the built in git libraries?
Second, how do I get that information from my repository? Using the git library, I can probably use the hook's context directly, but if I am running the system calls, how do I get the directory from which I need to run these commands?