Class DiffOperationsForCommitValidation
CommitValidationListener
s.
Computing the modified files for a merge commit may require the creation of the auto-merge
commit (usually the auto-merge commit is not created yet when the commit validators are invoked).
However commit validators should not write any commits (as the name
CommitValidationListener
suggests they are only intended to validate and listen). In particular
commit validators must not write the auto-merge commit with a new ObjectInserter
instance
that competes with the main ObjectInserter
instance that is being used to create changes,
patch sets and auto-merge commits. This class wraps the computation of modified files and takes
care of creating any missing auto-merge commit with the main ObjectInserter
instance, so
that the auto-merge commit is only created by this ObjectInserter
instance and there is
no competing ObjectInserter
instance that creates the same auto-merge commit. Creating
the same auto-merge commit with competing ObjectInserter
instances must be avoided as it
can result issues during object quorum.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionloadModifiedFilesAgainstParentIfNecessary
(Project.NameKey project, org.eclipse.jgit.lib.ObjectId newCommit, int parentNum, boolean enableRenameDetection) Retrieves the modified files from theModifiedFilesCache
if they are already cached.
-
Method Details
-
loadModifiedFilesAgainstParentIfNecessary
public Map<String,ModifiedFile> loadModifiedFilesAgainstParentIfNecessary(Project.NameKey project, org.eclipse.jgit.lib.ObjectId newCommit, int parentNum, boolean enableRenameDetection) throws DiffNotAvailableException Retrieves the modified files from theModifiedFilesCache
if they are already cached. If not, the modified files are loaded directly (using the mainRevWalk
instance that can see newly inserted objects) rather than loading them via theModifiedFilesCache
(that would open a newRevWalk
instance).If the loading requires the creation of the auto-merge commit it is created with the main
ObjectInserter
instance (also see the class javadoc).The results will be stored in the
ModifiedFilesCache
so that calling this method multiple times loads the modified files only once (for the first call, for further calls the cached modified files are returned).- Throws:
DiffNotAvailableException
-