ResolveMerger: extracting createGitLinksMergeResult method

Signed-off-by: Demetr Starshov <dstarshov@google.com>
Change-Id: Ibc8b954266b1b4b9b9f404e3433f0d7cdae107e8
This commit is contained in:
Demetr Starshov 2020-08-11 18:24:33 -07:00
parent e60ea7324f
commit 3da7ea50a9
1 changed files with 14 additions and 8 deletions

View File

@ -745,14 +745,8 @@ protected boolean processEntry(CanonicalTreeParser base,
add(tw.getRawPath(), theirs, DirCacheEntry.STAGE_3, EPOCH, 0); add(tw.getRawPath(), theirs, DirCacheEntry.STAGE_3, EPOCH, 0);
if (gitlinkConflict) { if (gitlinkConflict) {
MergeResult<SubmoduleConflict> result = new MergeResult<>( MergeResult<SubmoduleConflict> result = createGitLinksMergeResult(
Arrays.asList( base, ours, theirs);
new SubmoduleConflict(base == null ? null
: base.getEntryObjectId()),
new SubmoduleConflict(ours == null ? null
: ours.getEntryObjectId()),
new SubmoduleConflict(theirs == null ? null
: theirs.getEntryObjectId())));
result.setContainsConflicts(true); result.setContainsConflicts(true);
mergeResults.put(tw.getPathString(), result); mergeResults.put(tw.getPathString(), result);
if (!ignoreConflicts) { if (!ignoreConflicts) {
@ -825,6 +819,18 @@ protected boolean processEntry(CanonicalTreeParser base,
return true; return true;
} }
private MergeResult<SubmoduleConflict> createGitLinksMergeResult(
CanonicalTreeParser base, CanonicalTreeParser ours,
CanonicalTreeParser theirs) {
return new MergeResult<>(Arrays.asList(
new SubmoduleConflict(
base == null ? null : base.getEntryObjectId()),
new SubmoduleConflict(
ours == null ? null : ours.getEntryObjectId()),
new SubmoduleConflict(
theirs == null ? null : theirs.getEntryObjectId())));
}
/** /**
* Does the content merge. The three texts base, ours and theirs are * Does the content merge. The three texts base, ours and theirs are
* specified with {@link CanonicalTreeParser}. If any of the parsers is * specified with {@link CanonicalTreeParser}. If any of the parsers is