aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2012-03-12 10:14:02 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2012-03-12 10:14:02 -0400
commit95ceb24866c02a49ee9e0dcf5d2617879e98527f (patch)
treeb7d9804339e52d729f7f0962fc1e926767a53ae5
parentd1403512f5946a75b0de507c1b5bf47574eeeb98 (diff)
parent3734db92827329ec947fbb0eba98bcba123a2781 (diff)
downloadjgit-95ceb24866c02a49ee9e0dcf5d2617879e98527f.tar.gz
jgit-95ceb24866c02a49ee9e0dcf5d2617879e98527f.zip
Merge "Use object id provided by working tree iterator for submodules"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java20
1 files changed, 4 insertions, 16 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 867945362a..abd00c3779 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
@@ -43,7 +43,6 @@
*/
package org.eclipse.jgit.api;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
@@ -59,7 +58,6 @@ import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.treewalk.FileTreeIterator;
@@ -185,20 +183,10 @@ public class AddCommand extends GitCommand<DirCache> {
} finally {
in.close();
}
- builder.add(entry);
- lastAddedFile = path;
- } else {
- Repository subRepo = Git.open(
- new File(repo.getWorkTree(), path))
- .getRepository();
- ObjectId subRepoHead = subRepo
- .resolve(Constants.HEAD);
- if (subRepoHead != null) {
- entry.setObjectId(subRepoHead);
- builder.add(entry);
- lastAddedFile = path;
- }
- }
+ } else
+ entry.setObjectId(f.getEntryObjectId());
+ builder.add(entry);
+ lastAddedFile = path;
} else {
builder.add(c.getDirCacheEntry());
}