Merge branch 'stable-0.10'
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
index 2650db2..3442af9 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
@@ -43,6 +43,8 @@
 
 package org.eclipse.jgit.http.test;
 
+import java.io.IOException;
+
 import javax.servlet.http.HttpServletRequestWrapper;
 
 import org.eclipse.jetty.server.Request;
@@ -51,6 +53,7 @@
 import org.eclipse.jgit.http.server.resolver.ServiceNotEnabledException;
 import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
 import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
 
 public class AsIsServiceTest extends LocalDiskRepositoryTestCase {
 	private Repository db;
@@ -87,8 +90,11 @@ public void testCreate_Default() throws ServiceNotEnabledException,
 		service.access(new R("bob", "1.2.3.4"), db);
 	}
 
-	public void testCreate_Disabled() throws ServiceNotAuthorizedException {
-		db.getConfig().setBoolean("http", null, "getanyfile", false);
+	public void testCreate_Disabled() throws ServiceNotAuthorizedException,
+			IOException {
+		final StoredConfig cfg = db.getConfig();
+		cfg.setBoolean("http", null, "getanyfile", false);
+		cfg.save();
 
 		try {
 			service.access(new R(null, "1.2.3.4"), db);
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
index 4d05a08..81d5f4f 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
@@ -43,6 +43,8 @@
 
 package org.eclipse.jgit.http.test;
 
+import java.io.IOException;
+
 import javax.servlet.http.HttpServletRequestWrapper;
 
 import org.eclipse.jetty.server.Request;
@@ -53,6 +55,7 @@
 import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
 import org.eclipse.jgit.lib.PersonIdent;
 import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.transport.ReceivePack;
 
 public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
@@ -127,8 +130,11 @@ public void testCreate_AuthUser() throws ServiceNotEnabledException,
 		assertEquals(author.getWhen(), id.getWhen());
 	}
 
-	public void testCreate_Disabled() throws ServiceNotAuthorizedException {
-		db.getConfig().setBoolean("http", null, "receivepack", false);
+	public void testCreate_Disabled() throws ServiceNotAuthorizedException,
+			IOException {
+		final StoredConfig cfg = db.getConfig();
+		cfg.setBoolean("http", null, "receivepack", false);
+		cfg.save();
 
 		try {
 			factory.create(new R(null, "localhost"), db);
@@ -153,8 +159,11 @@ public void testCreate_Disabled() throws ServiceNotAuthorizedException {
 	}
 
 	public void testCreate_Enabled() throws ServiceNotEnabledException,
-			ServiceNotAuthorizedException {
-		db.getConfig().setBoolean("http", null, "receivepack", true);
+			ServiceNotAuthorizedException, IOException {
+		final StoredConfig cfg = db.getConfig();
+		cfg.setBoolean("http", null, "receivepack", true);
+		cfg.save();
+
 		ReceivePack rp;
 
 		rp = factory.create(new R(null, "1.2.3.4"), db);
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
index 423361e..24bf480 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
@@ -43,6 +43,8 @@
 
 package org.eclipse.jgit.http.test;
 
+import java.io.IOException;
+
 import javax.servlet.http.HttpServletRequestWrapper;
 
 import org.eclipse.jetty.server.Request;
@@ -52,6 +54,7 @@
 import org.eclipse.jgit.http.server.resolver.UploadPackFactory;
 import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
 import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.transport.UploadPack;
 
 public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
@@ -104,8 +107,11 @@ public void testCreate_Default() throws ServiceNotEnabledException,
 		assertSame(db, up.getRepository());
 	}
 
-	public void testCreate_Disabled() throws ServiceNotAuthorizedException {
-		db.getConfig().setBoolean("http", null, "uploadpack", false);
+	public void testCreate_Disabled() throws ServiceNotAuthorizedException,
+			IOException {
+		final StoredConfig cfg = db.getConfig();
+		cfg.setBoolean("http", null, "uploadpack", false);
+		cfg.save();
 
 		try {
 			factory.create(new R(null, "localhost"), db);
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
index c4912d4..6cf282f 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
@@ -68,6 +68,7 @@
 import org.eclipse.jgit.lib.RefUpdate;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
 import org.eclipse.jgit.storage.file.FileRepository;
 import org.eclipse.jgit.transport.FetchConnection;
 import org.eclipse.jgit.transport.Transport;
@@ -336,8 +337,9 @@ public void testListRemote_Smart_UploadPackNeedsAuth() throws Exception {
 
 	public void testListRemote_Smart_UploadPackDisabled() throws Exception {
 		FileRepository src = remoteRepository.getRepository();
-		src.getConfig().setBoolean("http", null, "uploadpack", false);
-		src.getConfig().save();
+		final FileBasedConfig cfg = src.getConfig();
+		cfg.setBoolean("http", null, "uploadpack", false);
+		cfg.save();
 
 		Repository dst = createBareRepository();
 		Transport t = Transport.open(dst, smartAuthNoneURI);
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index 491094c..f73f54f 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -500,9 +500,10 @@ public void testPush_ChunkedEncoding() throws Exception {
 
 		enableReceivePack();
 
-		db.getConfig().setInt("core", null, "compression", 0);
-		db.getConfig().setInt("http", null, "postbuffer", 8 * 1024);
-		db.getConfig().save();
+		final FileBasedConfig cfg = db.getConfig();
+		cfg.setInt("core", null, "compression", 0);
+		cfg.setInt("http", null, "postbuffer", 8 * 1024);
+		cfg.save();
 
 		t = Transport.open(db, remoteURI);
 		try {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
index 0bc72a7..8eccded 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
@@ -65,6 +65,7 @@
 import org.eclipse.jgit.lib.WorkDirCheckout;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
 import org.eclipse.jgit.storage.file.FileRepository;
 import org.eclipse.jgit.transport.FetchResult;
 import org.eclipse.jgit.transport.RefSpec;
@@ -110,8 +111,9 @@ protected void run() throws Exception {
 
 		dst = new FileRepository(gitdir);
 		dst.create();
-		dst.getConfig().setBoolean("core", null, "bare", false);
-		dst.getConfig().save();
+		final FileBasedConfig dstcfg = dst.getConfig();
+		dstcfg.setBoolean("core", null, "bare", false);
+		dstcfg.save();
 		db = dst;
 
 		out.print(MessageFormat.format(
@@ -128,13 +130,14 @@ protected void run() throws Exception {
 
 	private void saveRemote(final URIish uri) throws URISyntaxException,
 			IOException {
-		final RemoteConfig rc = new RemoteConfig(dst.getConfig(), remoteName);
+		final FileBasedConfig dstcfg = dst.getConfig();
+		final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName);
 		rc.addURI(uri);
 		rc.addFetchRefSpec(new RefSpec().setForceUpdate(true)
 				.setSourceDestination(Constants.R_HEADS + "*",
 						Constants.R_REMOTES + remoteName + "/*"));
-		rc.update(dst.getConfig());
-		dst.getConfig().save();
+		rc.update(dstcfg);
+		dstcfg.save();
 	}
 
 	private FetchResult runFetch() throws NotSupportedException,
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java
index 10396b4..27e0b1b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java
@@ -47,9 +47,9 @@
 
 import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.lib.Config;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryTestCase;
+import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevTag;
 import org.eclipse.jgit.transport.RefSpec;
@@ -66,11 +66,12 @@ public void testFetch() throws JGitInternalException, IOException,
 		Git git2 = new Git(db2);
 
 		// setup the first repository to fetch from the second repository
-		final Config config = db.getConfig();
+		final StoredConfig config = db.getConfig();
 		RemoteConfig remoteConfig = new RemoteConfig(config, "test");
 		URIish uri = new URIish(db2.getDirectory().toURI().toURL());
 		remoteConfig.addURI(uri);
 		remoteConfig.update(config);
+		config.save();
 
 		// create some refs via commits and tag
 		RevCommit commit = git2.commit().setMessage("initial commit").call();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
index 48ede96..5d54a1c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
@@ -199,8 +199,8 @@ protected void setUp() throws Exception {
 						.getPath()));
 		config.addFetchRefSpec(new RefSpec(
 				"+refs/heads/*:refs/remotes/origin/*"));
-		targetConfig.save();
 		config.update(targetConfig);
+		targetConfig.save();
 
 		targetFile = new File(dbTarget.getWorkTree(), "SomeFile.txt");
 		writeToFile(targetFile, "Hello world");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java
index d9a0786..04232f6 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java
@@ -48,9 +48,9 @@
 import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.MissingObjectException;
-import org.eclipse.jgit.lib.Config;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryTestCase;
+import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevTag;
 import org.eclipse.jgit.transport.RefSpec;
@@ -66,11 +66,12 @@ public void testPush() throws JGitInternalException, IOException,
 		Repository db2 = createWorkRepository();
 
 		// setup the first repository
-		final Config config = db.getConfig();
+		final StoredConfig config = db.getConfig();
 		RemoteConfig remoteConfig = new RemoteConfig(config, "test");
 		URIish uri = new URIish(db2.getDirectory().toURI().toURL());
 		remoteConfig.addURI(uri);
 		remoteConfig.update(config);
+		config.save();
 
 		Git git1 = new Git(db);
 		// create some refs via commits and tag
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
index ded7e58..ea8b17d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
@@ -47,6 +47,8 @@
 
 import java.io.IOException;
 
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+
 public class ReflogConfigTest extends RepositoryTestCase {
 	public void testlogAllRefUpdates() throws Exception {
 		long commitTime = 1154236443000L;
@@ -55,7 +57,9 @@ public void testlogAllRefUpdates() throws Exception {
 		// check that there are no entries in the reflog and turn off writing
 		// reflogs
 		assertEquals(0, db.getReflogReader(Constants.HEAD).getReverseEntries().size());
-		db.getConfig().setBoolean("core", null, "logallrefupdates", false);
+		final FileBasedConfig cfg = db.getConfig();
+		cfg.setBoolean("core", null, "logallrefupdates", false);
+		cfg.save();
 
 		// do one commit and check that reflog size is 0: no reflogs should be
 		// written
@@ -69,8 +73,9 @@ public void testlogAllRefUpdates() throws Exception {
 				db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 0);
 
 		// set the logAllRefUpdates parameter to true and check it
-		db.getConfig().setBoolean("core", null, "logallrefupdates", true);
-		assertTrue(db.getConfig().get(CoreConfig.KEY).isLogAllRefUpdates());
+		cfg.setBoolean("core", null, "logallrefupdates", true);
+		cfg.save();
+		assertTrue(cfg.get(CoreConfig.KEY).isLogAllRefUpdates());
 
 		// do one commit and check that reflog size is increased to 1
 		addFileToTree(t, "i-am-another-file", "and this is other data in me\n");
@@ -82,8 +87,9 @@ public void testlogAllRefUpdates() throws Exception {
 				db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 1);
 
 		// set the logAllRefUpdates parameter to false and check it
-		db.getConfig().setBoolean("core", null, "logallrefupdates", false);
-		assertFalse(db.getConfig().get(CoreConfig.KEY).isLogAllRefUpdates());
+		cfg.setBoolean("core", null, "logallrefupdates", false);
+		cfg.save();
+		assertFalse(cfg.get(CoreConfig.KEY).isLogAllRefUpdates());
 
 		// do one commit and check that reflog size is 2
 		addFileToTree(t, "i-am-anotheranother-file",
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java
index 2057020..6044f25 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java
@@ -182,9 +182,9 @@ public void test000_openrepo_default_absolute_workdirconfig()
 		workdir.mkdir();
 		FileRepository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
 		repo1initial.create();
-		repo1initial.getConfig().setString("core", null, "worktree",
-				workdir.getAbsolutePath());
-		repo1initial.getConfig().save();
+		final FileBasedConfig cfg = repo1initial.getConfig();
+		cfg.setString("core", null, "worktree", workdir.getAbsolutePath());
+		cfg.save();
 		repo1initial.close();
 
 		File theDir = new File(repo1Parent, Constants.DOT_GIT);
@@ -207,9 +207,9 @@ public void test000_openrepo_default_relative_workdirconfig()
 		workdir.mkdir();
 		FileRepository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
 		repo1initial.create();
-		repo1initial.getConfig()
-				.setString("core", null, "worktree", "../../rw");
-		repo1initial.getConfig().save();
+		final FileBasedConfig cfg = repo1initial.getConfig();
+		cfg.setString("core", null, "worktree", "../../rw");
+		cfg.save();
 		repo1initial.close();
 
 		File theDir = new File(repo1Parent, Constants.DOT_GIT);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
index 22eeb8e..67fae27 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
@@ -46,6 +46,9 @@
 import java.io.File;
 import java.security.MessageDigest;
 
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.dircache.DirCacheCheckout;
+import org.eclipse.jgit.dircache.DirCacheEntry;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
 import org.eclipse.jgit.lib.ObjectId;
@@ -175,6 +178,24 @@ public void testComputeFileObjectId() throws Exception {
 		assertEquals(expect, top.getEntryObjectId());
 	}
 
+	public void testIsModifiedSymlink() throws Exception {
+		File f = writeTrashFile("symlink", "content");
+		Git git = new Git(db);
+		git.add().addFilepattern("symlink").call();
+		git.commit().setMessage("commit").call();
+
+		// Modify previously committed DirCacheEntry and write it back to disk
+		DirCacheEntry dce = db.readDirCache().getEntry("symlink");
+		dce.setFileMode(FileMode.SYMLINK);
+		DirCacheCheckout.checkoutEntry(db, f, dce);
+
+		FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db
+				.getConfig().get(WorkingTreeOptions.KEY));
+		while (!fti.getEntryPathString().equals("symlink"))
+			fti.next(1);
+		assertFalse(fti.isModified(dce, false));
+	}
+
 	private static String nameOf(final AbstractTreeIterator i) {
 		return RawParseUtils.decode(Constants.CHARSET, i.path, 0, i.pathLen);
 	}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
index fa00581..a88dd2a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
@@ -59,6 +59,7 @@
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.RefUpdate;
 import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevWalk;
@@ -156,10 +157,11 @@ public List<String> call() throws JGitInternalException,
 						String shortenedName = fullName
 								.substring(Constants.R_HEADS.length());
 						// remove upstream configuration if any
-						repo.getConfig().unsetSection(
+						final StoredConfig cfg = repo.getConfig();
+						cfg.unsetSection(
 								ConfigConstants.CONFIG_BRANCH_SECTION,
 								shortenedName);
-						repo.getConfig().save();
+						cfg.save();
 					}
 				} else
 					throw new JGitInternalException(MessageFormat.format(
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
index 4fe050b..adcea90 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
@@ -186,7 +186,7 @@ public PullResult call() throws WrongRepositoryStateException,
 		String remoteUri;
 		FetchResult fetchRes;
 		if (isRemote) {
-			remoteUri = repo.getConfig().getString("remote", remote,
+			remoteUri = repoConfig.getString("remote", remote,
 					ConfigConstants.CONFIG_KEY_URL);
 			if (remoteUri == null) {
 				String missingKey = ConfigConstants.CONFIG_REMOTE_SECTION + DOT
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
index 4654981..04b7791 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
@@ -58,6 +58,7 @@
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.RefRename;
 import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.lib.RefUpdate.Result;
 
 /**
@@ -144,27 +145,28 @@ public Ref call() throws RefNotFoundException, InvalidRefNameException,
 					// move the upstream configuration over to the new branch
 					String shortOldName = fullOldName
 							.substring(Constants.R_HEADS.length());
-					String oldRemote = repo.getConfig().getString(
+					final StoredConfig repoConfig = repo.getConfig();
+					String oldRemote = repoConfig.getString(
 							ConfigConstants.CONFIG_BRANCH_SECTION,
 							shortOldName, ConfigConstants.CONFIG_KEY_REMOTE);
 					if (oldRemote != null) {
-						repo.getConfig().setString(
+						repoConfig.setString(
 								ConfigConstants.CONFIG_BRANCH_SECTION, newName,
 								ConfigConstants.CONFIG_KEY_REMOTE, oldRemote);
 					}
-					String oldMerge = repo.getConfig().getString(
+					String oldMerge = repoConfig.getString(
 							ConfigConstants.CONFIG_BRANCH_SECTION,
 							shortOldName, ConfigConstants.CONFIG_KEY_MERGE);
 					if (oldMerge != null) {
-						repo.getConfig().setString(
+						repoConfig.setString(
 								ConfigConstants.CONFIG_BRANCH_SECTION, newName,
 								ConfigConstants.CONFIG_KEY_MERGE, oldMerge);
 					}
-					repo.getConfig()
+					repoConfig
 							.unsetSection(
 									ConfigConstants.CONFIG_BRANCH_SECTION,
 									shortOldName);
-					repo.getConfig().save();
+					repoConfig.save();
 				}
 
 			} else
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index c9df809..c856d1a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -130,7 +130,7 @@ public List<String> getConflicts() {
 	 *         {@link DirCacheCheckout}.
 	 */
 	public List<String> getToBeDeleted() {
-		return conflicts;
+		return toBeDeleted;
 	}
 
 	/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
index a145e77..417fa4b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
@@ -160,7 +160,7 @@ public FileRepository(final BaseRepositoryBuilder options) throws IOException {
 		loadUserConfig();
 		loadRepoConfig();
 
-		getConfig().addChangeListener(new ConfigChangedListener() {
+		repoConfig.addChangeListener(new ConfigChangedListener() {
 			public void onConfigChanged(ConfigChangedEvent event) {
 				fireEvent(event);
 			}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
index 6365c11..69d9b22 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -556,15 +556,19 @@ public boolean isModified(DirCacheEntry entry, boolean forceContentCheck) {
 		// bitwise presentation of modeDiff we'll have a '1' when the two modes
 		// differ at this position.
 		int modeDiff = getEntryRawMode() ^ entry.getRawMode();
-		// Ignore the executable file bits if checkFilemode tells me to do so.
-		// Ignoring is done by setting the bits representing a EXECUTABLE_FILE
-		// to '0' in modeDiff
-		if (!state.options.isFileMode())
-			modeDiff &= ~FileMode.EXECUTABLE_FILE.getBits();
-		if (modeDiff != 0)
-			// Report a modification if the modes still (after potentially
-			// ignoring EXECUTABLE_FILE bits) differ
-			return true;
+
+		// Do not rely on filemode differences in case of symbolic links
+		if (modeDiff != 0 && !FileMode.SYMLINK.equals(entry.getRawMode())) {
+			// Ignore the executable file bits if WorkingTreeOptions tell me to
+			// do so. Ignoring is done by setting the bits representing a
+			// EXECUTABLE_FILE to '0' in modeDiff
+			if (!state.options.isFileMode())
+				modeDiff &= ~FileMode.EXECUTABLE_FILE.getBits();
+			if (modeDiff != 0)
+				// Report a modification if the modes still (after potentially
+				// ignoring EXECUTABLE_FILE bits) differ
+				return true;
+		}
 
 		// Git under windows only stores seconds so we round the timestamp
 		// Java gives us if it looks like the timestamp in index is seconds