Commits

Sebastian Sdorra committed 4d678f7

indent and logging

Comments (0)

Files changed (1)

scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitReceiveHook.java

   {
     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;
    *
    *
    * @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
+   *
+   *
+   * @param rc
    *
    * @return
    */