diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2013-02-18 23:59:20 +0100 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2013-03-10 16:53:23 +0100 |
commit | 3cd089f04cf1122e6a9d0a6f842ddd0b46a7a9bd (patch) | |
tree | 3cea25d94f70e733d4799aca9ffe7b9a9e896963 /org.eclipse.jgit | |
parent | 9105e1c9afe161a84cf612d532454f57207383fa (diff) | |
download | jgit-3cd089f04cf1122e6a9d0a6f842ddd0b46a7a9bd.tar.gz jgit-3cd089f04cf1122e6a9d0a6f842ddd0b46a7a9bd.zip |
A folder does not constitute a dirty work tree
This fixes two cases:
- A folder without tracked content exist both in the workdir and merged
commit, as long as there names within that folder does not conflict.
- An empty folder structure exists with the same name as a file in the
merged commit.
Bug: 402834
Change-Id: I4c5b9f11313dd1665fcbdae2d0755fdb64deb3ef
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java | 3 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java | 5 |
2 files changed, 6 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 292206e539..dd9023fc77 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -1129,7 +1129,8 @@ public class DirCacheCheckout { if (!tmpFile.renameTo(f)) { // tried to rename which failed. Let' delete the target file and try // again - FileUtils.delete(f); + FileUtils.delete(f, FileUtils.EMPTY_DIRECTORIES_ONLY + | FileUtils.RECURSIVE); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index bea2119333..213a1d4daa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -621,7 +621,10 @@ public class ResolveMerger extends ThreeWayMerger { boolean isDirty = work.isModeDifferent(modeO); if (!isDirty && nonTree(modeF)) isDirty = !tw.idEqual(T_FILE, T_OURS); - + // Ignore existing empty directories + if (isDirty && modeF == FileMode.TYPE_TREE + && modeO == FileMode.TYPE_MISSING) + isDirty = false; if (isDirty) failingPaths.put(tw.getPathString(), MergeFailureReason.DIRTY_WORKTREE); |