From 9072103f3b3cf64dd12ad2949836ab98f62dabf1 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Fri, 11 Aug 2023 21:40:13 +0200 Subject: Checkout: better directory handling When checking out a file into the working tree ensure that all parent directories of the file below the working tree root are actually directories and do exist before we try to create the file. When multiple files are to be checked out (or even a whole tree), this may check the same directories over and over again. Asking the file system every time for file attributes is a potentially expensive operation. As a remedy, introduce an in-memory cache of directory states for a particular check-out operation. Apply the same fix also in the ResolveMerger, which may also check out files, and also in the PatchApplier. In PatchApplier, also validate paths. Change-Id: Ie12864c54c9f901a2ccee7caddec73027f353111 Signed-off-by: Thomas Wolf Signed-off-by: Matthias Sohn --- .../resources/org/eclipse/jgit/internal/JGitText.properties | 2 ++ 1 file changed, 2 insertions(+) (limited to 'org.eclipse.jgit/resources/org/eclipse') diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index bc8144f1c9..3ac1fde6f0 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -20,6 +20,8 @@ applyBinaryPatchTypeNotSupported=Couldn't apply binary patch of type {0} applyTextPatchCannotApplyHunk=Hunk cannot be applied applyTextPatchSingleClearingHunk=Expected a single hunk for clearing all content applyBinaryResultOidWrong=Result of binary patch for file {0} has wrong OID +applyPatchDestInvalid=Destination path in patch is invalid +applyPatchSourceInvalid==Source path in patch is invalid applyPatchWithoutSourceOnAlreadyExistingSource=Cannot perform {0} action on an existing file applyPatchWithCreationOverAlreadyExistingDestination=Cannot perform {0} action which overrides an existing file applyPatchWithSourceOnNonExistentSource=Cannot perform {0} action on a non-existent file -- cgit v1.2.3