diff options
author | Stefan Lay <stefan.lay@sap.com> | 2010-07-22 11:26:04 +0200 |
---|---|---|
committer | Stefan Lay <stefan.lay@sap.com> | 2010-07-22 11:26:04 +0200 |
commit | aa86cfc33960938a62a8d0b300a153749bedfc64 (patch) | |
tree | abd3bb27007fb1d0e0a6bcafe9eb129b355d2e41 /org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java | |
parent | 09910ffa32e472481a3ba237cf99d803576c9172 (diff) | |
download | jgit-aa86cfc33960938a62a8d0b300a153749bedfc64.tar.gz jgit-aa86cfc33960938a62a8d0b300a153749bedfc64.zip |
Do not add ignored files in Add command
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java index 23e30ca68b..50db1ffc14 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java @@ -130,12 +130,16 @@ public class AddCommand extends GitCommand<DirCache> { String path = tw.getPathString(); final File file = new File(repo.getWorkDir(), path); + FileTreeIterator f = tw.getTree(1, FileTreeIterator.class); + if (tw.getTree(0, DirCacheIterator.class) == null && + f != null && f.isEntryIgnored()) { + // file is not in index but is ignored, do nothing + } // In case of an existing merge conflict the // DirCacheBuildIterator iterates over all stages of // this path, we however want to add only one // new DirCacheEntry per path. - if (!(path.equals(lastAddedFile))) { - FileTreeIterator f = tw.getTree(1, FileTreeIterator.class); + else if (!(path.equals(lastAddedFile))) { if (f != null) { // the file exists DirCacheEntry entry = new DirCacheEntry(path); entry.setLength((int)f.getEntryLength()); |