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:
parent
576abf64d1
commit
a7d3c68015
|
@ -66,6 +66,7 @@
|
||||||
import org.eclipse.jgit.errors.UnmergedPathException;
|
import org.eclipse.jgit.errors.UnmergedPathException;
|
||||||
import org.eclipse.jgit.lib.CommitBuilder;
|
import org.eclipse.jgit.lib.CommitBuilder;
|
||||||
import org.eclipse.jgit.lib.Constants;
|
import org.eclipse.jgit.lib.Constants;
|
||||||
|
import org.eclipse.jgit.lib.FileMode;
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
import org.eclipse.jgit.lib.ObjectInserter;
|
import org.eclipse.jgit.lib.ObjectInserter;
|
||||||
import org.eclipse.jgit.lib.PersonIdent;
|
import org.eclipse.jgit.lib.PersonIdent;
|
||||||
|
@ -341,17 +342,24 @@ private DirCache createTemporaryIndex(ObjectId headId, DirCache index)
|
||||||
if (objectExists) {
|
if (objectExists) {
|
||||||
dcEntry.setObjectId(fTree.getEntryObjectId());
|
dcEntry.setObjectId(fTree.getEntryObjectId());
|
||||||
} else {
|
} else {
|
||||||
// insert object
|
if (FileMode.GITLINK.equals(dcEntry.getFileMode())) {
|
||||||
if (inserter == null)
|
// Do not check the content of submodule entries
|
||||||
inserter = repo.newObjectInserter();
|
// Use the old entry information instead.
|
||||||
|
dcEntry.copyMetaData(index.getEntry(dcEntry
|
||||||
|
.getPathString()));
|
||||||
|
} else {
|
||||||
|
// insert object
|
||||||
|
if (inserter == null)
|
||||||
|
inserter = repo.newObjectInserter();
|
||||||
|
|
||||||
InputStream inputStream = fTree.openEntryStream();
|
InputStream inputStream = fTree.openEntryStream();
|
||||||
try {
|
try {
|
||||||
dcEntry.setObjectId(inserter.insert(
|
dcEntry.setObjectId(inserter.insert(
|
||||||
Constants.OBJ_BLOB, entryLength,
|
Constants.OBJ_BLOB, entryLength,
|
||||||
inputStream));
|
inputStream));
|
||||||
} finally {
|
} finally {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue