diff --git a/services/git-bridge/.idea/compiler.xml b/services/git-bridge/.idea/compiler.xml
index ca4e0c0cae..13e26ea226 100644
--- a/services/git-bridge/.idea/compiler.xml
+++ b/services/git-bridge/.idea/compiler.xml
@@ -26,7 +26,7 @@
-
+
\ No newline at end of file
diff --git a/services/git-bridge/.idea/encodings.xml b/services/git-bridge/.idea/encodings.xml
index b26911bd02..c0bce70846 100644
--- a/services/git-bridge/.idea/encodings.xml
+++ b/services/git-bridge/.idea/encodings.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/services/git-bridge/.idea/misc.xml b/services/git-bridge/.idea/misc.xml
index e04d97a9fa..dfca8c47e5 100644
--- a/services/git-bridge/.idea/misc.xml
+++ b/services/git-bridge/.idea/misc.xml
@@ -10,5 +10,33 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/services/git-bridge/pom.xml b/services/git-bridge/pom.xml
index 0c09457bdc..a1e87cfdd4 100644
--- a/services/git-bridge/pom.xml
+++ b/services/git-bridge/pom.xml
@@ -16,8 +16,8 @@
maven-compiler-plugin
3.2
- 1.7
- 1.7
+ 1.8
+ 1.8
@@ -81,12 +81,12 @@
org.eclipse.jgit
org.eclipse.jgit
- 3.6.0.201412230720-r
+ 4.4.1.201607150455-r
org.eclipse.jgit
org.eclipse.jgit.http.server
- 3.6.0.201412230720-r
+ 4.4.1.201607150455-r
org.xerial
diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/WLBridgedProject.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/WLBridgedProject.java
index cf56ca6082..9fc2b694c4 100644
--- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/WLBridgedProject.java
+++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/WLBridgedProject.java
@@ -48,7 +48,7 @@ public class WLBridgedProject {
} catch (InvalidProjectException e) {
throw new RepositoryNotFoundException(name);
} catch (SnapshotPostException e) {
- throw new RepositoryNotFoundException(name);
+ throw new ServiceMayNotContinueException(e.getDescriptionLines().get(0), e);
} catch (GitAPIException e) {
throw new ServiceMayNotContinueException(e);
} catch (IOException e) {
diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/git/handler/hook/WriteLatexPutHook.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/git/handler/hook/WriteLatexPutHook.java
index fb32b85f5c..3f3331172c 100644
--- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/git/handler/hook/WriteLatexPutHook.java
+++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/git/handler/hook/WriteLatexPutHook.java
@@ -19,6 +19,7 @@ import uk.ac.ic.wlgitbridge.util.Log;
import java.io.IOException;
import java.util.Collection;
+import java.util.Iterator;
/**
* Created by Winston on 03/11/14.
@@ -57,9 +58,17 @@ public class WriteLatexPutHook implements PreReceiveHook {
private void handleSnapshotPostException(ReceivePack receivePack, ReceiveCommand receiveCommand, SnapshotPostException e) {
String message = e.getMessage();
receivePack.sendError(message);
- for (String line : e.getDescriptionLines()) {
- receivePack.sendMessage("hint: " + line);
+ StringBuilder msg = new StringBuilder();
+ for (Iterator it = e.getDescriptionLines().iterator(); it.hasNext();) {
+ String line = it.next();
+ msg.append("hint: ");
+ msg.append(line);
+ if (it.hasNext()) {
+ msg.append('\n');
+ }
}
+ receivePack.sendMessage("");
+ receivePack.sendMessage(msg.toString());
receiveCommand.setResult(Result.REJECTED_OTHER_REASON, message);
}
diff --git a/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java
index ab7e65e165..b253a7b6df 100644
--- a/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java
+++ b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java
@@ -2,6 +2,7 @@ package uk.ac.ic.wlgitbridge;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.Response;
+import org.apache.commons.io.IOUtils;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.junit.Rule;
import org.junit.Test;
@@ -22,8 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
/**
* Created by Winston on 11/01/15.
@@ -336,8 +336,6 @@ public class WLGitBridgeIntegrationTest {
}
private static final String EXPECTED_OUT_PUSH_OUT_OF_DATE_FIRST =
- "To http://127.0.0.1:33867/testproj.git\n" +
- " ! [rejected] master -> master (non-fast-forward)\n" +
"error: failed to push some refs to 'http://127.0.0.1:33867/testproj.git'\n" +
"hint: Updates were rejected because the tip of your current branch is behind\n" +
"hint: its remote counterpart. Integrate the remote changes (e.g.\n" +
@@ -367,8 +365,6 @@ public class WLGitBridgeIntegrationTest {
}
private static final String EXPECTED_OUT_PUSH_OUT_OF_DATE_SECOND =
- "To http://127.0.0.1:33868/testproj.git\n" +
- " ! [rejected] master -> master (non-fast-forward)\n" +
"error: failed to push some refs to 'http://127.0.0.1:33868/testproj.git'\n" +
"hint: Updates were rejected because the tip of your current branch is behind\n" +
"hint: its remote counterpart. Integrate the remote changes (e.g.\n" +
@@ -398,7 +394,6 @@ public class WLGitBridgeIntegrationTest {
}
private static final List EXPECTED_OUT_PUSH_INVALID_FILES = Arrays.asList(
- "remote: error: invalid files",
"remote: hint: You have 4 invalid files in your Overleaf project:",
"remote: hint: file1.invalid (error)",
"remote: hint: file2.exe (invalid file extension)",
@@ -433,7 +428,6 @@ public class WLGitBridgeIntegrationTest {
}
private static final List EXPECTED_OUT_PUSH_INVALID_PROJECT = Arrays.asList(
- "remote: error: invalid project",
"remote: hint: project: no main file",
"remote: hint: The project would have no (editable) main .tex file.",
"To http://127.0.0.1:33870/testproj.git",
@@ -465,7 +459,6 @@ public class WLGitBridgeIntegrationTest {
}
private static final List EXPECTED_OUT_PUSH_UNEXPECTED_ERROR = Arrays.asList(
- "remote: error: Overleaf error",
"remote: hint: There was an internal error with the Overleaf server.",
"remote: hint: Please contact Overleaf.",
"To http://127.0.0.1:33871/testproj.git",
@@ -499,6 +492,7 @@ public class WLGitBridgeIntegrationTest {
private static final List EXPECTED_OUT_PUSH_INVALID_EXE_FILE = Arrays.asList(
"remote: error: invalid files",
+ "remote:",
"remote: hint: You have 1 invalid files in your Overleaf project:",
"remote: hint: file1.exe (invalid file extension)",
"To http://127.0.0.1:33872/testproj.git",
@@ -595,8 +589,14 @@ public class WLGitBridgeIntegrationTest {
private File cloneRepository(String repositoryName, int port, File dir) throws IOException, InterruptedException {
String repo = "git clone http://127.0.0.1:" + port + "/" + repositoryName + ".git";
- assertEquals(0, runtime.exec(repo, null, dir).waitFor());
-
+ Process gitProcess = runtime.exec(repo, null, dir);
+ int exitCode = gitProcess.waitFor();
+ if (exitCode != 0) {
+ System.err.println("git clone failed. Dumping stderr and stdout.");
+ System.err.println(IOUtils.toString(gitProcess.getErrorStream()));
+ System.err.println(IOUtils.toString(gitProcess.getInputStream()));
+ fail("git clone failed");
+ }
File repositoryDir = new File(dir, repositoryName);
assertEquals(0, runtime.exec("git config user.name TEST", null, repositoryDir).waitFor());
diff --git a/services/git-bridge/writelatex-git-bridge.iml b/services/git-bridge/writelatex-git-bridge.iml
index 9c08c80468..ad352655dc 100644
--- a/services/git-bridge/writelatex-git-bridge.iml
+++ b/services/git-bridge/writelatex-git-bridge.iml
@@ -1,20 +1,17 @@
-
+
+
-
-
+
-
-
-
@@ -37,14 +34,14 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
+