瀏覽代碼

Use object id provided by working tree iterator for submodules

The working tree iterator now supports providing an object id
for submodule entries and this value should be used instead
of recomputing it again in AddCommand.

Change-Id: I30082514c23fc65968bb78add5ad69a1ca95cf3a
tags/v2.0.0.201206130900-r
Kevin Sawicki 12 年之前
父節點
當前提交
3734db9282
共有 1 個檔案被更改,包括 4 行新增16 行删除
  1. 4
    16
      org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java

+ 4
- 16
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());
}

Loading…
取消
儲存