From ddb1a0c3a27c9a226601a7d909dcbca0c7a9da18 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 18 Aug 2022 18:10:47 +0200 Subject: [PATCH] WorkTreeUpdater#Result: hide data members This is the standard across JGit. Change-Id: Ie52ad7000d8725657b33dd4f3adcc05ab9666875 --- .../org/eclipse/jgit/merge/ResolveMerger.java | 8 +++--- .../eclipse/jgit/util/WorkTreeUpdater.java | 25 ++++++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index ab82dd0c30..d79f5d4100 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -1181,12 +1181,12 @@ public class ResolveMerger extends ThreeWayMerger { workTreeUpdater.writeWorkTreeChanges(true); if (getUnmergedPaths().isEmpty() && !failed()) { WorkTreeUpdater.Result result = workTreeUpdater.writeIndexChanges(); - resultTree = result.treeId; - modifiedFiles = result.modifiedFiles; - for (String f : result.failedToDelete) { + resultTree = result.getTreeId(); + modifiedFiles = result.getModifiedFiles(); + for (String f : result.getFailedToDelete()) { failingPaths.put(f, MergeFailureReason.COULD_NOT_DELETE); } - return result.failedToDelete.isEmpty(); + return result.getFailedToDelete().isEmpty(); } resultTree = null; return false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java index 98eaf931b8..a9f56c2ac9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java @@ -74,20 +74,33 @@ public class WorkTreeUpdater implements Closeable { */ public static class Result { + private final List modifiedFiles = new LinkedList<>(); + + + private final List failedToDelete = new LinkedList<>(); + + private ObjectId treeId = null; + /** - * Files modified during this operation. + * @return Modified tree ID if any, or null otherwise. */ - public List modifiedFiles = new LinkedList<>(); + public ObjectId getTreeId() { + return treeId; + } /** - * Files in this list were failed to be deleted. + * @return Files that couldn't be deleted. */ - public List failedToDelete = new LinkedList<>(); + public List getFailedToDelete() { + return failedToDelete; + } /** - * Modified tree ID if any, or null otherwise. + * @return Files modified during this operation. */ - public ObjectId treeId = null; + public List getModifiedFiles() { + return modifiedFiles; + } } Result result = new Result(); -- 2.39.5