Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2012-09-21 06:06:49 +0000
committerRobin Stocker2013-02-12 20:34:51 +0000
commit64c50c5d3db240cb228307e7553d1059ba87c3c9 (patch)
treee01ef432615f73838017ddc86cb5c185c0db9e8d
parente9d0ac6c074135eb9cc6a97dc373d458ec3e8d67 (diff)
downloadegit-64c50c5d3db240cb228307e7553d1059ba87c3c9.tar.gz
egit-64c50c5d3db240cb228307e7553d1059ba87c3c9.tar.xz
egit-64c50c5d3db240cb228307e7553d1059ba87c3c9.zip
Auto-ignore derived resources
Automatically ignore derived resources. Register a resource change listener to detect resources marked as derived asynchronously. Auto-ignore can be switched off using a new preference. Bug: 297674 Change-Id: I02d0e12e9bee94b1121a1fa57eedfc268dd8e5ef Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java14
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java9
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java32
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java86
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/CoreText.java7
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferenceInitializer.java2
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferences.java4
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/JobFamilies.java7
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/coretext.properties2
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java29
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java8
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/ProjectsPreferencePage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties3
14 files changed, 206 insertions, 6 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
index 00e5316c62..722726b626 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
+ * Copyright (C) 2007, 2013 Robin Rosenberg <robin.rosenberg@dewire.com> and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -15,7 +15,10 @@ import java.io.IOException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.egit.core.Activator;
+import org.eclipse.egit.core.GitCorePreferences;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -26,6 +29,7 @@ import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.SystemReader;
import org.junit.After;
import org.junit.Before;
+import org.junit.BeforeClass;
public abstract class GitTestCase {
@@ -35,6 +39,14 @@ public abstract class GitTestCase {
protected File gitDir;
+ @BeforeClass
+ public static void setUpClass() {
+ // suppress auto-ignoring to avoid interference
+ IEclipsePreferences p = InstanceScope.INSTANCE.getNode(Activator
+ .getPluginId());
+ p.putBoolean(GitCorePreferences.core_autoIgnoreDerivedResources, false);
+ }
+
@Before
public void setUp() throws Exception {
// ensure there are no shared Repository instances left
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java
index f6808ea6df..31e759ee3d 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java
@@ -2,6 +2,7 @@
* Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2006, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2012, Robin Stocker <robin@nibor.org>
+ * Copyright (C) 2013, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -51,6 +52,8 @@ public class TestProject {
private final File workspaceSupplement;
+ private IFolder binFolder;
+
/**
* @throws CoreException
* If project already exists
@@ -96,13 +99,17 @@ public class TestProject {
project.create(description, null);
project.open(null);
javaProject = JavaCore.create(project);
- IFolder binFolder = createBinFolder();
+ binFolder = createBinFolder();
setJavaNature();
javaProject.setRawClasspath(new IClasspathEntry[0], null);
createOutputFolder(binFolder);
addSystemLibraries();
}
+ public void setBinFolderDerived() throws CoreException {
+ binFolder.setDerived(true, null);
+ }
+
public File getWorkspaceSupplement() {
return workspaceSupplement;
}
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
index b4f80f18e5..6992908bed 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
@@ -1,6 +1,7 @@
/*******************************************************************************
* Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
+ * Copyright (C) 2013, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -20,6 +21,14 @@ import java.io.IOException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.egit.core.Activator;
+import org.eclipse.egit.core.GitCorePreferences;
+import org.eclipse.egit.core.JobFamilies;
+import org.eclipse.egit.core.RepositoryUtil;
import org.eclipse.egit.core.op.ConnectProviderOperation;
import org.eclipse.egit.core.test.GitTestCase;
import org.eclipse.egit.core.test.TestRepository;
@@ -58,6 +67,29 @@ public class ConnectProviderOperationTest extends GitTestCase {
}
@Test
+ public void testAutoIgnoresDerivedFolder() throws Exception {
+ // enable auto-ignore
+ IEclipsePreferences p = InstanceScope.INSTANCE.getNode(Activator
+ .getPluginId());
+ p.putBoolean(GitCorePreferences.core_autoIgnoreDerivedResources, true);
+ Repository repository = new FileRepository(gitDir);
+ repository.create();
+ repository.close();
+ project.setBinFolderDerived();
+ ConnectProviderOperation operation = new ConnectProviderOperation(
+ project.getProject(), gitDir);
+ operation.execute(null);
+
+ assertTrue(RepositoryProvider.isShared(project.getProject()));
+ Job.getJobManager().join(JobFamilies.AUTO_IGNORE, null);
+
+ IPath binPath = project.getProject().getLocation().append("bin");
+ assertTrue(RepositoryUtil.isIgnored(binPath));
+ assertTrue(gitDir.exists());
+ p.putBoolean(GitCorePreferences.core_autoIgnoreDerivedResources, false);
+ }
+
+ @Test
public void testNewUnsharedFile() throws CoreException, Exception {
project.createSourceFolder();
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
index d37f450f89..da526798b5 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
- * Copyright (C) 2011, Matthias Sohn <matthias.sohn@sap.com>
+ * Copyright (C) 2011, 2013 Matthias Sohn <matthias.sohn@sap.com>
* Copyright (C) 2013, Robin Stocker <robin@nibor.org>
*
* All rights reserved. This program and the accompanying materials
@@ -12,9 +12,13 @@
package org.eclipse.egit.core;
import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Dictionary;
import java.util.Hashtable;
+import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -24,6 +28,7 @@ import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Plugin;
@@ -35,6 +40,7 @@ import org.eclipse.egit.core.internal.indexdiff.IndexDiffCache;
import org.eclipse.egit.core.internal.job.JobUtil;
import org.eclipse.egit.core.internal.trace.GitTraceLocation;
import org.eclipse.egit.core.op.ConnectProviderOperation;
+import org.eclipse.egit.core.op.IgnoreOperation;
import org.eclipse.egit.core.project.GitProjectData;
import org.eclipse.egit.core.project.RepositoryFinder;
import org.eclipse.egit.core.project.RepositoryMapping;
@@ -60,6 +66,7 @@ public class Activator extends Plugin implements DebugOptionsListener {
private EGitSecureStore secureStore;
private AutoShareProjects shareGitProjectsJob;
private IResourceChangeListener preDeleteProjectListener;
+ private IgnoreDerivedResources ignoreDerivedResourcesListener;
/**
* @return the singleton {@link Activator}
@@ -138,6 +145,7 @@ public class Activator extends Plugin implements DebugOptionsListener {
secureStore = new EGitSecureStore(SecurePreferencesFactory.getDefault());
registerAutoShareProjects();
+ registerAutoIgnoreDerivedResources();
registerPreDeleteResourceChangeListener();
}
@@ -208,6 +216,11 @@ public class Activator extends Plugin implements DebugOptionsListener {
ResourcesPlugin.getWorkspace().removeResourceChangeListener(preDeleteProjectListener);
preDeleteProjectListener = null;
}
+ if (ignoreDerivedResourcesListener != null) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(
+ ignoreDerivedResourcesListener);
+ ignoreDerivedResourcesListener = null;
+ }
}
private void registerAutoShareProjects() {
@@ -291,4 +304,75 @@ public class Activator extends Plugin implements DebugOptionsListener {
}
}
}
+
+ private void registerAutoIgnoreDerivedResources() {
+ ignoreDerivedResourcesListener = new IgnoreDerivedResources();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ ignoreDerivedResourcesListener,
+ IResourceChangeEvent.POST_CHANGE);
+ }
+
+ private static class IgnoreDerivedResources implements
+ IResourceChangeListener {
+
+ protected boolean autoIgnoreDerived() {
+ IEclipsePreferences d = DefaultScope.INSTANCE.getNode(Activator
+ .getPluginId());
+ IEclipsePreferences p = InstanceScope.INSTANCE.getNode(Activator
+ .getPluginId());
+ return p.getBoolean(
+ GitCorePreferences.core_autoIgnoreDerivedResources,
+ d.getBoolean(
+ GitCorePreferences.core_autoIgnoreDerivedResources,
+ true));
+ }
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ IResourceDelta d = event.getDelta();
+ if (d == null || !autoIgnoreDerived())
+ return;
+
+ final List<IPath> toBeIgnored = new ArrayList<IPath>();
+
+ d.accept(new IResourceDeltaVisitor() {
+
+ public boolean visit(IResourceDelta delta)
+ throws CoreException {
+ if ((delta.getKind() & (IResourceDelta.ADDED | IResourceDelta.CHANGED)) == 0)
+ return false;
+ int flags = delta.getFlags();
+ if ((flags != 0)
+ && ((flags & IResourceDelta.DERIVED_CHANGED) == 0))
+ return false;
+
+ final IResource r = delta.getResource();
+ if (r.isTeamPrivateMember())
+ return false;
+
+ if (r.isDerived()) {
+ try {
+ if (!RepositoryUtil.isIgnored(r.getLocation()))
+ toBeIgnored.add(r.getLocation());
+ } catch (IOException e) {
+ logError(
+ MessageFormat.format(
+ CoreText.Activator_ignoreResourceFailed,
+ r.getFullPath()), e);
+ }
+ return false;
+ }
+ return true;
+ }
+ });
+ if (toBeIgnored.size() > 0)
+ JobUtil.scheduleUserJob(new IgnoreOperation(toBeIgnored),
+ CoreText.Activator_autoIgnoreDerivedResources,
+ JobFamilies.AUTO_IGNORE);
+ } catch (CoreException e) {
+ Activator.logError(e.getMessage(), e);
+ return;
+ }
+ }
+ }
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/CoreText.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/CoreText.java
index aa5b3c5e6e..9a7675dc47 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/CoreText.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/CoreText.java
@@ -3,6 +3,7 @@
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2012, Robin Stocker <robin@nibor.org>
* Copyright (C) 2012, Markus Duft <markus.duft@salomon.at>
+ * Copyright (C) 2013, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,12 +27,18 @@ public class CoreText extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.egit.core.coretext"; //$NON-NLS-1$
/** */
+ public static String Activator_autoIgnoreDerivedResources;
+
+ /** */
public static String Activator_AutoShareJobName;
/** */
public static String Activator_AutoSharingFailed;
/** */
+ public static String Activator_ignoreResourceFailed;
+
+ /** */
public static String Activator_ReconfigureWindowCacheError;
/** */
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferenceInitializer.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferenceInitializer.java
index 237a0eac1c..0c7bfec679 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferenceInitializer.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferenceInitializer.java
@@ -1,6 +1,7 @@
/*******************************************************************************
* Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
+ * Copyright (C) 2013, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,5 +27,6 @@ public class GitCorePreferenceInitializer extends AbstractPreferenceInitializer
p.putInt(GitCorePreferences.core_deltaBaseCacheLimit, 10 * MB);
p.putInt(GitCorePreferences.core_streamFileThreshold, 50 * MB);
p.putBoolean(GitCorePreferences.core_autoShareProjects, false);
+ p.putBoolean(GitCorePreferences.core_autoIgnoreDerivedResources, true);
}
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferences.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferences.java
index edb2d354a7..14c0a40e82 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferences.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitCorePreferences.java
@@ -1,6 +1,7 @@
/*******************************************************************************
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2011, Robin Rosenberg
+ * Copyright (C) 2013, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -30,6 +31,9 @@ public class GitCorePreferences {
public static final String core_autoShareProjects =
"core_autoShareProjects"; //$NON-NLS-1$
/** */
+ public static final String core_autoIgnoreDerivedResources =
+ "core_autoIgnoreDerivedResources"; //$NON-NLS-1$
+ /** */
public static final String core_gitPrefix =
"core_gitPrefix"; //$NON-NLS-1$
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/JobFamilies.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/JobFamilies.java
index 84388a90d9..698b7d4026 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/JobFamilies.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/JobFamilies.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (C) 2011, Matthias Sohn <matthias.sohn@sap.com>
+ * Copyright (C) 2011, 2013 Matthias Sohn <matthias.sohn@sap.com> and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -28,4 +28,9 @@ public class JobFamilies {
* Job family for auto share job
*/
public static final Object AUTO_SHARE = new Object();
+
+ /**
+ * Job family for auto ignore job
+ */
+ public static final Object AUTO_IGNORE = new Object();
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/coretext.properties b/org.eclipse.egit.core/src/org/eclipse/egit/core/coretext.properties
index eb4dab52a0..19d3d94337 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/coretext.properties
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/coretext.properties
@@ -32,8 +32,10 @@ DeleteResourcesOperation_deleteFailed=Deleting resource {0} failed.
DeleteResourcesOperation_deleteFailedSeeLog=Deleting resources failed. See log for details
DisconnectProviderOperation_disconnecting=Disconnecting Git team provider.
+Activator_autoIgnoreDerivedResources=Auto-ignore derived resources
Activator_AutoShareJobName=Auto share git projects
Activator_AutoSharingFailed=Auto sharing project with git failed
+Activator_ignoreResourceFailed=Ignoring {0} failed
Activator_ReconfigureWindowCacheError=Exception when reconfiguring window cache from configuration, default configuration will be used
AssumeUnchangedOperation_adding=Marking resources unchanged
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java
index 4dfb0fc55b..4370e6c406 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java
@@ -2,6 +2,7 @@
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2008, Google Inc.
* Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua>
+ * Copyright (C) 2013, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -12,16 +13,20 @@ package org.eclipse.egit.core.op;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
@@ -146,6 +151,7 @@ public class ConnectProviderOperation implements IEGitOperation {
}
RepositoryProvider
.map(project, GitProvider.class.getName());
+ autoIgnoreDerivedResources(project, monitor);
project.refreshLocal(IResource.DEPTH_INFINITE,
new SubProgressMonitor(monitor, 50));
monitor.worked(10);
@@ -164,6 +170,29 @@ public class ConnectProviderOperation implements IEGitOperation {
}
}
+ private void autoIgnoreDerivedResources(IProject project,
+ IProgressMonitor monitor) throws CoreException {
+ List<IPath> paths = findDerivedResources(project);
+ if (paths.size() > 0) {
+ IgnoreOperation ignoreOp = new IgnoreOperation(paths);
+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+ ignoreOp.execute(subMonitor);
+ }
+ }
+
+ private List<IPath> findDerivedResources(IContainer c)
+ throws CoreException {
+ List<IPath> derived = new ArrayList<IPath>();
+ IResource[] members = c.members(IContainer.INCLUDE_HIDDEN);
+ for (IResource r : members) {
+ if (r.isDerived())
+ derived.add(r.getLocation());
+ else if (r instanceof IContainer)
+ derived.addAll(findDerivedResources((IContainer) r));
+ }
+ return derived;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.egit.core.op.IEGitOperation#getSchedulingRule()
*/
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
index 0b116353a1..d707c67262 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
@@ -28,7 +28,10 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.egit.core.Activator;
+import org.eclipse.egit.core.GitCorePreferences;
import org.eclipse.egit.core.RepositoryCache;
import org.eclipse.egit.core.op.AddToIndexOperation;
import org.eclipse.egit.core.op.CloneOperation;
@@ -140,6 +143,11 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
File repoRoot = new File(testDirectory, "RepositoryRoot");
if (!repoRoot.exists())
FileUtils.mkdir(repoRoot, true);
+ // suppress auto-ignoring to avoid interference
+ IEclipsePreferences corePrefs = InstanceScope.INSTANCE
+ .getNode(org.eclipse.egit.core.Activator.getPluginId());
+ corePrefs.putBoolean(
+ GitCorePreferences.core_autoIgnoreDerivedResources, false);
// make sure the default directory for Repos is not the user home
org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore()
.setValue(UIPreferences.DEFAULT_REPO_DIR, repoRoot.getPath());
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index ed3fcaf983..b20f5aeaf8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
- * Copyright (C) 2010, Matthias Sohn <matthias.sohn@sap.com>
+ * Copyright (C) 2010, 2013 Matthias Sohn <matthias.sohn@sap.com>
* Copyright (C) 2011, Daniel Megert <daniel_megert@ch.ibm.com>
* Copyright (C) 2012, Mathias Kinzler <mathias.kinzler@sap.com>
* Copyright (C) 2012, Daniel Megert <daniel_megert@ch.ibm.com>
@@ -642,6 +642,9 @@ public class UIText extends NLS {
public static String ProjectsPreferencePage_RestoreBranchProjects;
/** */
+ public static String ProjectsPreferencePage_AutoIgnoreDerivedResources;
+
+ /** */
public static String GitProjectPropertyPage_LabelBranch;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/ProjectsPreferencePage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/ProjectsPreferencePage.java
index 770ea560d6..11cd373b0b 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/ProjectsPreferencePage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/ProjectsPreferencePage.java
@@ -51,5 +51,9 @@ public class ProjectsPreferencePage extends FieldEditorPreferencePage implements
.getPreferenceStore();
}
});
+ addField(new BooleanFieldEditor(
+ GitCorePreferences.core_autoIgnoreDerivedResources,
+ UIText.ProjectsPreferencePage_AutoIgnoreDerivedResources,
+ getFieldEditorParent()));
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index 88259e29d9..6e825f59d5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005, 2012 Shawn Pearce and others.
+# Copyright (c) 2005, 2013 Shawn Pearce and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -900,6 +900,7 @@ WindowCachePreferencePage_streamFileThreshold=Stream File Threshold:
ProjectsPreferencePage_AutoShareProjects=Auto share projects located in a git repository
ProjectsPreferencePage_RestoreBranchProjects=Track each branch's imported projects and restore on checkout
+ProjectsPreferencePage_AutoIgnoreDerivedResources=Automatically ignore derived resources by adding them to .gitignore
RefreshPreferencesPage_RefreshOnlyWhenActive=Refresh only when workbench is &active
RefreshPreferencesPage_RefreshWhenIndexChange=Refresh resources when &index changes

Back to the top