Allow commit when submodule changes are present

We do not yet check or validate submodules, but can accept that
someone staged a change in a submodule with other tools.

Change-Id: I642ede382314bfbd1892dd509a2222885cc5350a
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
This commit is contained in:
Robin Rosenberg 2011-09-04 16:34:15 +02:00
parent 576abf64d1
commit a7d3c68015
1 changed files with 18 additions and 10 deletions

View File

@ -66,6 +66,7 @@
import org.eclipse.jgit.errors.UnmergedPathException;
import org.eclipse.jgit.lib.CommitBuilder;
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.PersonIdent;
@ -340,6 +341,12 @@ private DirCache createTemporaryIndex(ObjectId headId, DirCache index)
|| (hTree != null && fTree.idEqual(hTree));
if (objectExists) {
dcEntry.setObjectId(fTree.getEntryObjectId());
} else {
if (FileMode.GITLINK.equals(dcEntry.getFileMode())) {
// Do not check the content of submodule entries
// Use the old entry information instead.
dcEntry.copyMetaData(index.getEntry(dcEntry
.getPathString()));
} else {
// insert object
if (inserter == null)
@ -354,6 +361,7 @@ private DirCache createTemporaryIndex(ObjectId headId, DirCache index)
inputStream.close();
}
}
}
// update index
dcEditor.add(new PathEdit(path) {