diff options
author | Robin Stocker <robin@nibor.org> | 2012-09-23 01:37:09 +0200 |
---|---|---|
committer | Chris Aniszczyk <zx@twitter.com> | 2012-11-16 10:12:40 -0800 |
commit | a2e691351f4c5217a908410c1bd796efa6b01023 (patch) | |
tree | fa94d37a1bbbacf4b9048b344c4589f10cd840ef /org.eclipse.jgit/src/org/eclipse | |
parent | 05a7113002063b80cf48591594c7e01cd2111ec6 (diff) | |
download | jgit-a2e691351f4c5217a908410c1bd796efa6b01023.tar.gz jgit-a2e691351f4c5217a908410c1bd796efa6b01023.zip |
DirCacheEditor: Apply PathEdit for each stage
This behavior was defined in the Javadoc of PathEdit, but not actually
implemented.
It's necessary when one wants to use a PathEdit to check out a specific
stage in apply.
Bug: 390147
Change-Id: Iaed5cf60c554fc17e6c4d188caf4f0231da920d0
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java index 6c12c402b6..b0cb34c352 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java @@ -146,18 +146,21 @@ public class DirCacheEditor extends BaseDirCacheEditor { continue; } - final DirCacheEntry ent; if (missing) { - ent = new DirCacheEntry(e.path); + final DirCacheEntry ent = new DirCacheEntry(e.path); e.apply(ent); if (ent.getRawMode() == 0) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().fileModeNotSetForPath , ent.getPathString())); + fastAdd(ent); } else { - ent = cache.getEntry(eIdx); - e.apply(ent); + // Apply to all entries of the current path (different stages) + for (int i = eIdx; i < lastIdx; i++) { + final DirCacheEntry ent = cache.getEntry(i); + e.apply(ent); + fastAdd(ent); + } } - fastAdd(ent); } final int cnt = maxIdx - lastIdx; |