aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2012-01-09 16:15:12 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2013-08-21 14:44:47 +0200
commitbd57789735b6f80378db7284470f867e04cbd2b4 (patch)
treebe8418807a67975af11fc9c4005878886a7189f7 /org.eclipse.jgit
parentab4ade41c401c2030e78cd92e7c7ee2e2d2f0696 (diff)
downloadjgit-bd57789735b6f80378db7284470f867e04cbd2b4.tar.gz
jgit-bd57789735b6f80378db7284470f867e04cbd2b4.zip
Make sure checkout is not deleting folders outside the workingtree
There was a chance that jgit deletes symbolic links which point to the folder on top of the working tree. Make sure not to touch these resources. Thanks to Cedric Darloy who reported this bug on http://www.eclipse.org/forums/index.php/m/776910/#msg_776910 and to Ondrej Vrabec who reported bug 412489. Bug: 412489 Change-Id: I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java4
1 files changed, 2 insertions, 2 deletions
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 684cf21ae8..5458426b1a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -417,7 +417,7 @@ public class DirCacheCheckout {
builder.finish();
File file = null;
- String last = ""; //$NON-NLS-1$
+ String last = null;
// when deleting files process them in the opposite order as they have
// been reported. This ensures the files are deleted before we delete
// their parent folders
@@ -433,7 +433,7 @@ public class DirCacheCheckout {
if (!file.isDirectory())
toBeDeleted.add(r);
} else {
- if (!isSamePrefix(r, last))
+ if (last != null && !isSamePrefix(r, last))
removeEmptyParents(new File(repo.getWorkTree(), last));
last = r;
}