mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-03 12:05:52 +01:00
use repository directory as working directory for git repository hooks
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user