use repository directory as working directory for git repository hooks

This commit is contained in:
Sebastian Sdorra
2012-02-23 20:55:36 +01:00
parent 7ab0b5950e
commit bd7397763d

View File

@@ -136,23 +136,24 @@ public class GitReceiveHook implements PreReceiveHook, PostReceiveHook
/**
* Method description
*
*
*
*
*
* @param rpack
* @param rc
* @param repositoryDirectory
* @param hook
* @param oldId
* @param newId
* @param refName
*/
private void executeFileHook(ReceivePack rpack, ReceiveCommand rc, File hook,
private void executeFileHook(ReceivePack rpack, ReceiveCommand rc,
File repositoryDirectory, File hook,
ObjectId oldId, ObjectId newId, String refName)
{
final Command cmd = new SimpleCommand(hook.getAbsolutePath(), getId(oldId),
getId(newId), Util.nonNull(refName));
// issue-99
cmd.setWorkDirectory(repositoryDirectory);
try
{
CommandResult result = cmd.execute();
@@ -286,7 +287,7 @@ public class GitReceiveHook implements PreReceiveHook, PostReceiveHook
if (hookScript != null)
{
executeFileHook(rpack, rc, hookScript, oldId, newId,
executeFileHook(rpack, rc, directory, hookScript, oldId, newId,
rc.getRefName());
}
}