Git test framework failing on windows

FileUtils.delete cannot remove read-only files, and some of the files
creating by EGit/Jgit within the test repositories (.git/objects files)
are set as read-only, leading to test failures because we cannot
clear up the test workspace after each test.

This also changes the test framework to using try-with-resources where
potential errors were identified.

Change-Id: Ibfb54584cc7ccdcae09e56abe0b1c79001e68394
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.classpath b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.classpath
index 098194c..3e5654f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.classpath
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.classpath
@@ -1,7 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="src">
+		<attributes>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.settings/org.eclipse.jdt.core.prefs
index 79ea86f..cfb6a75 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/.settings/org.eclipse.jdt.core.prefs
@@ -8,9 +8,9 @@
 org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -101,8 +101,9 @@
 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -110,17 +111,20 @@
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -206,11 +210,12 @@
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
 org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -241,6 +246,8 @@
 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
 org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
 org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -265,13 +272,17 @@
 org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
 org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
 org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
 org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -319,6 +330,8 @@
 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -355,9 +368,12 @@
 org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
 org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
 org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -383,7 +399,11 @@
 org.eclipse.jdt.core.formatter.tabulation.size=4
 org.eclipse.jdt.core.formatter.use_on_off_tags=false
 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
 org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
 org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
 org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/META-INF/MANIFEST.MF
index f45eb14..ae36b03 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/META-INF/MANIFEST.MF
@@ -22,7 +22,7 @@
  org.eclipse.jface,
  org.eclipse.emf.compare.egit,
  org.eclipse.team.ui;bundle-version="3.5.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
 Export-Package: org.eclipse.emf.compare.ide.ui.tests.git.framework,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/AbstractGitOperationStatement.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/AbstractGitOperationStatement.java
index 1f54db0..ad2b876 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/AbstractGitOperationStatement.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/AbstractGitOperationStatement.java
@@ -86,7 +86,9 @@
 			if (expected != None.class) {
 				fail("Expected exception : " + expected.getName()); //$NON-NLS-1$
 			}
+			// CHECKSTYLE:OFF We want to catch every throwable here
 		} catch (Throwable e) {
+			// CHECKSTYLE:ON
 			if (expected.isAssignableFrom(e.getClass())) {
 				// success
 			} else {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/InternalGitTestSupport.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/InternalGitTestSupport.java
index 6a383c4..d2bfaf2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/InternalGitTestSupport.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git.framework/src/org/eclipse/emf/compare/ide/ui/tests/git/framework/internal/statements/InternalGitTestSupport.java
@@ -16,13 +16,17 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Comparator;
+import java.util.stream.Stream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
@@ -33,7 +37,6 @@
 import org.eclipse.egit.core.op.ConnectProviderOperation;
 import org.eclipse.egit.core.op.DisconnectProviderOperation;
 import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.util.FileUtils;
 import org.eclipse.ui.dialogs.IOverwriteQuery;
 import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
 import org.eclipse.ui.wizards.datatransfer.ImportOperation;
@@ -233,20 +236,20 @@
 	 *             Thrown if the zip extraction goes wrong
 	 */
 	private void extractArchive(Class<?> clazz, String path, IWorkspaceRoot root) throws IOException {
-		InputStream resourceAsStream = clazz.getResourceAsStream(path);
-		ZipInputStream zipIn = new ZipInputStream(resourceAsStream);
-		ZipEntry entry = null;
-		while ((entry = zipIn.getNextEntry()) != null) {
-			String filePath = root.getLocation() + File.separator + entry.getName();
-			if (!entry.isDirectory()) {
-				extractFile(zipIn, filePath);
-			} else {
-				File dir = new File(filePath);
-				dir.mkdir();
+		try (InputStream resourceAsStream = clazz.getResourceAsStream(path);
+				ZipInputStream zipIn = new ZipInputStream(resourceAsStream);) {
+			ZipEntry entry = null;
+			while ((entry = zipIn.getNextEntry()) != null) {
+				String filePath = root.getLocation() + File.separator + entry.getName();
+				if (!entry.isDirectory()) {
+					extractFile(zipIn, filePath);
+				} else {
+					File dir = new File(filePath);
+					dir.mkdir();
+				}
+				zipIn.closeEntry();
 			}
-			zipIn.closeEntry();
 		}
-		zipIn.close();
 	}
 
 	/**
@@ -260,13 +263,13 @@
 	 *             Thrown if something happen during the extraction
 	 */
 	private void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
-		BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
-		byte[] bytesIn = new byte[BUFFER_SIZE];
-		int read = 0;
-		while ((read = zipIn.read(bytesIn)) != -1) {
-			bos.write(bytesIn, 0, read);
+		try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));) {
+			byte[] bytesIn = new byte[BUFFER_SIZE];
+			int read = 0;
+			while ((read = zipIn.read(bytesIn)) != -1) {
+				bos.write(bytesIn, 0, read);
+			}
 		}
-		bos.close();
 	}
 
 	/**
@@ -292,7 +295,10 @@
 		if (listFiles != null) {
 			for (File child : listFiles) {
 				if (!child.getName().equals(METADATA_FOLDER)) {
-					FileUtils.delete(child, FileUtils.RECURSIVE | FileUtils.RETRY);
+					try (Stream<java.nio.file.Path> walk = Files.walk(child.toPath())) {
+						walk.sorted(Comparator.reverseOrder()).map(java.nio.file.Path::toFile)
+								.forEach(File::delete);
+					}
 				}
 			}
 		}
@@ -325,6 +331,8 @@
 			for (IProject iProject : projects) {
 				iProject.delete(true, new NullProgressMonitor());
 			}
+			ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE,
+					new NullProgressMonitor());
 		}
 
 		File file = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
@@ -332,7 +340,10 @@
 		if (listFiles != null) {
 			for (File child : listFiles) {
 				if (!child.getName().equals(METADATA_FOLDER)) {
-					FileUtils.delete(child, FileUtils.RECURSIVE | FileUtils.RETRY);
+					try (Stream<java.nio.file.Path> walk = Files.walk(child.toPath())) {
+						walk.sorted(Comparator.reverseOrder()).map(java.nio.file.Path::toFile)
+								.forEach(File::delete);
+					}
 				}
 			}
 		}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.classpath b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.classpath
index eca7bdb..3e5654f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.classpath
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.classpath
@@ -2,6 +2,10 @@
 <classpath>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="src">
+		<attributes>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.jdt.core.prefs
index 75adc0e..cfb6a75 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.jdt.core.prefs
@@ -103,6 +103,7 @@
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
 org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -110,17 +111,20 @@
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -206,11 +210,12 @@
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
 org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -241,6 +246,8 @@
 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
 org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
 org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -265,13 +272,17 @@
 org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
 org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
 org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
 org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -319,6 +330,8 @@
 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -355,9 +368,12 @@
 org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
 org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
 org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -383,7 +399,11 @@
 org.eclipse.jdt.core.formatter.tabulation.size=4
 org.eclipse.jdt.core.formatter.use_on_off_tags=false
 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
 org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
 org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
 org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java
index ef48827..27a4319 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java
@@ -21,7 +21,9 @@
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
+import java.util.stream.Stream;
 
 import org.eclipse.compare.ITypedElement;
 import org.eclipse.core.resources.IFile;
@@ -59,7 +61,6 @@
 import org.eclipse.emf.compare.scope.IComparisonScope;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.util.FileUtils;
 import org.eclipse.jgit.util.SystemReader;
 import org.eclipse.team.core.subscribers.Subscriber;
 import org.junit.After;
@@ -120,7 +121,9 @@
 		repository.dispose();
 		Activator.getDefault().getRepositoryCache().clear();
 		if (gitDir.exists()) {
-			FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY);
+			try (Stream<java.nio.file.Path> walk = Files.walk(gitDir.toPath())) {
+				walk.sorted(Comparator.reverseOrder()).map(java.nio.file.Path::toFile).forEach(File::delete);
+			}
 		}
 		super.tearDown();
 	}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java
index 8ff3257..aaf87a2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java
@@ -56,6 +56,7 @@
 import org.eclipse.jgit.api.Status;
 import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
+import org.eclipse.jgit.internal.storage.file.FileRepository;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.RefUpdate;
@@ -88,8 +89,10 @@
 	 *             Thrown if we cannot write at the given location.
 	 */
 	public GitTestRepository(File gitDir) throws IOException {
+		FileRepository tmpRepository = new FileRepository(gitDir);
+		tmpRepository.create();
+		tmpRepository.close();
 		repository = Activator.getDefault().getRepositoryCache().lookupRepository(gitDir);
-		repository.create();
 
 		try {
 			workdirPrefix = repository.getWorkTree().getCanonicalPath();
@@ -203,12 +206,9 @@
 	}
 
 	public RevCommit addAllAndCommit(String commitMessage) throws Exception {
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			git.add().addFilepattern(".").call();
 			return commit(commitMessage);
-		} finally {
-			git.close();
 		}
 	}
 
@@ -222,12 +222,9 @@
 	 *             if anything goes wrong.
 	 */
 	public RevCommit addAllAndAmend(String message) throws Exception {
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			git.add().addFilepattern(".").call();
 			return git.commit().setAmend(true).setMessage(message).call();
-		} finally {
-			git.close();
 		}
 	}
 
@@ -289,8 +286,7 @@
 	public void addToIndex(IResource resource)
 			throws CoreException, IOException, NoFilepatternException, GitAPIException {
 		String repoPath = getRepoRelativePath(resource.getLocation().toString());
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			git.add().addFilepattern(repoPath).call();
 			// removed files cannot be added to the index through this add command.
 			// see bug 494323 for more details on this limitation, but
@@ -300,8 +296,6 @@
 			// Will add all of the files from the repository to the index, excepted untracked files (new files
 			// added to the repository)
 			git.add().addFilepattern(repoPath).setUpdate(true).call();
-		} finally {
-			git.close();
 		}
 	}
 
@@ -383,14 +377,11 @@
 	 */
 	public void addToIndex(IResource... resources)
 			throws CoreException, IOException, NoFilepatternException, GitAPIException {
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			for (IResource resource : resources) {
 				String repoPath = getRepoRelativePath(resource.getLocation().toString());
 				git.add().addFilepattern(repoPath).call();
 			}
-		} finally {
-			git.close();
 		}
 	}
 
@@ -402,14 +393,11 @@
 	 */
 	public void removeFromIndex(IResource... resources)
 			throws CoreException, IOException, NoFilepatternException, GitAPIException {
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			for (IResource resource : resources) {
 				String repoPath = getRepoRelativePath(resource.getLocation().toString());
 				git.rm().addFilepattern(repoPath).call();
 			}
-		} finally {
-			git.close();
 		}
 	}
 
@@ -421,15 +409,12 @@
 	 * @return commit object
 	 */
 	public RevCommit commit(String message) throws Exception {
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			CommitCommand commitCommand = git.commit();
 			commitCommand.setAuthor("J. Git", "j.git@egit.org");
 			commitCommand.setCommitter(commitCommand.getAuthor());
 			commitCommand.setMessage(message);
 			return commitCommand.call();
-		} finally {
-			git.close();
 		}
 	}
 
@@ -580,11 +565,8 @@
 	 * @throws Exception
 	 */
 	public Status status() throws Exception {
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			return git.status().call();
-		} finally {
-			git.close();
 		}
 	}
 
@@ -598,11 +580,8 @@
 	 */
 	public void track(File file) throws IOException, NoFilepatternException, GitAPIException {
 		String repoPath = getRepoRelativePath(new Path(file.getPath()).toString());
-		Git git = new Git(repository);
-		try {
+		try (Git git = new Git(repository)) {
 			git.add().addFilepattern(repoPath).call();
-		} finally {
-			git.close();
 		}
 	}
 
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java
index 5f39f29..12cc9df 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java
@@ -14,6 +14,9 @@
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
+import java.nio.file.Files;
+import java.util.Comparator;
+import java.util.stream.Stream;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
@@ -43,7 +46,6 @@
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jgit.api.ResetCommand.ResetType;
 import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.util.FileUtils;
 import org.eclipse.jgit.util.SystemReader;
 import org.junit.After;
 import org.junit.AfterClass;
@@ -123,7 +125,10 @@
 		if (gitDir.exists()) {
 			File gitRoot = gitDir.getParentFile();
 			if (gitRoot.exists()) {
-				FileUtils.delete(gitRoot, FileUtils.RECURSIVE | FileUtils.RETRY);
+				try (Stream<java.nio.file.Path> walk = Files.walk(gitRoot.toPath())) {
+					walk.sorted(Comparator.reverseOrder()).map(java.nio.file.Path::toFile)
+							.forEach(File::delete);
+				}
 			}
 		}
 	}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java
index 4146a46..cd1ab2a 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java
@@ -12,6 +12,9 @@
  *******************************************************************************/
 package org.eclipse.emf.compare.ide.ui.tests.suite;
 
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.egit.core.GitCorePreferences;
 import org.eclipse.emf.compare.ComparePackage;
 import org.eclipse.emf.compare.ide.ui.tests.merge.AdditiveMergeTests;
 import org.eclipse.emf.compare.ide.ui.tests.merge.DirCacheResourceVariantTreeProviderTest;
@@ -62,6 +65,15 @@
 public class GitTests {
 
 	@BeforeClass
+	public static void disableEGitAutomaticBehavior() {
+		// suppress auto-ignoring and auto-sharing to avoid interference
+		IEclipsePreferences eGitPreferences = InstanceScope.INSTANCE
+				.getNode(org.eclipse.egit.core.Activator.getPluginId());
+		eGitPreferences.put(GitCorePreferences.core_preferredMergeStrategy, "model recursive");
+		eGitPreferences.putBoolean(GitCorePreferences.core_autoShareProjects, false);
+	}
+
+	@BeforeClass
 	public static void fillEMFRegistries() {
 		EPackage.Registry.INSTANCE.put(ComparePackage.eNS_URI, ComparePackage.eINSTANCE);
 		EPackage.Registry.INSTANCE.put(NodesPackage.eNS_URI, NodesPackage.eINSTANCE);