diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitReceiveHook.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitReceiveHook.java index e41495afe2..fed98e2d5b 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitReceiveHook.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitReceiveHook.java @@ -249,11 +249,20 @@ public class GitReceiveHook implements PreReceiveHook, PostReceiveHook { for (ReceiveCommand rc : receiveCommands) { - if (((RepositoryHookType.PRE_RECEIVE == type) - && (rc.getResult() - == ReceiveCommand.Result.NOT_ATTEMPTED)) || ((RepositoryHookType - .POST_RECEIVE == type) && (rc.getResult() - == ReceiveCommand.Result.OK))) + if (logger.isTraceEnabled()) + { + //J- + logger.trace("receive command, type={}, ref={}, result={}", + new Object[] { + rc.getType(), + rc.getRefName(), + rc.getResult() + } + ); + //J+ + } + + if (isReceiveable(rc, type)) { ObjectId newId = rc.getNewId(); ObjectId oldId = null; @@ -345,6 +354,25 @@ public class GitReceiveHook implements PreReceiveHook, PostReceiveHook return id; } + /** + * Method description + * + * + * @param rc + * @param type + * + * @return + */ + private boolean isReceiveable(ReceiveCommand rc, RepositoryHookType type) + { + //J- + return ((RepositoryHookType.PRE_RECEIVE == type) && + (rc.getResult() == ReceiveCommand.Result.NOT_ATTEMPTED)) || + ((RepositoryHookType.POST_RECEIVE == type) && + (rc.getResult() == ReceiveCommand.Result.OK)); + //J+ + } + /** * Method description *