Skip to content

The Unified and Autonomous Development Platform

Use /bin/bash instead of /bin/sh in git hooks.

robin shinee482b20bd56d
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/hookcallback/GitPostReceiveCallback.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/hookcallback/GitPostReceiveCallback.java
index 473cd0be8c..93b6cc70e8 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/hookcallback/GitPostReceiveCallback.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/hookcallback/GitPostReceiveCallback.java
@@ -118,7 +118,7 @@ public class GitPostReceiveCallback extends HttpServlet {
repository.git().updateDefaultBranch(branchName);
branch.setDefault(true);
}
- dao.persist(branch);
+ branchManager.save(branch);
} else if (newCommitHash.equals(GitUtils.NULL_SHA1)) {
Branch branch = branchManager.findBy(repository, branchName);
Preconditions.checkNotNull(branch);
@@ -147,7 +147,7 @@ public class GitPostReceiveCallback extends HttpServlet {
for (RepositoryListener listener: listenersProvider.get())
listener.commitReceived(repository, newCommitHash);
} catch (Exception e) {
- logger.error("Error indexing repository '" + repository + "'", e);
+ logger.error("Error notifying commit of repository '" + repository + "'", e);
}
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
index 2680b42b9e..50f6d336eb 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
@@ -284,7 +284,7 @@ public class Repository extends AbstractEntity implements UserBelonging {
try {
String content = FileUtils.readFileToString(updateHook);
- return content.contains("GITOP_USER_ID");
+ return content.contains("GITPLEX_USER_ID");
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/gitplex.core/src/main/resources/git-postreceive-hook b/gitplex.core/src/main/resources/git-postreceive-hook
index 50d9d7c747..3a085d31f4 100644
--- a/gitplex.core/src/main/resources/git-postreceive-hook
+++ b/gitplex.core/src/main/resources/git-postreceive-hook
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
IFS=$'\r\n';
lines=($(curl -k -s -S -f -X POST -d @- ${GITPLEX_URL}/git-postreceive-callback/${GITPLEX_REPOSITORY_ID}/${GITPLEX_USER_ID} 2>&1))
diff --git a/gitplex.core/src/main/resources/git-update-hook b/gitplex.core/src/main/resources/git-update-hook
index 1403115e5c..fbb4b4d933 100644
--- a/gitplex.core/src/main/resources/git-update-hook
+++ b/gitplex.core/src/main/resources/git-update-hook
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
IFS=$'\r\n';
lines=($(
curl -k -s -S -f -X POST -d @- ${GITPLEX_URL}/git-update-callback/${GITPLEX_REPOSITORY_ID}/${GITPLEX_USER_ID} 2>&1 <<EOF
diff --git a/gitplex.product/src/test/java/gitplex/product/Test.java b/gitplex.product/src/test/java/gitplex/product/Test.java
index b10dd53b80..9edb16e334 100644
--- a/gitplex.product/src/test/java/gitplex/product/Test.java
+++ b/gitplex.product/src/test/java/gitplex/product/Test.java
@@ -2,10 +2,13 @@ package gitplex.product;
import java.io.IOException;
+import org.apache.commons.lang3.StringUtils;
+
public class Test {
@org.junit.Test
public void test() throws IOException {
+ System.out.println(StringUtils.substringBefore("hello", "."));
}
}
\ No newline at end of file