From 2cef1a59ff33fd9829a7fb2bc777f675f5a75f30 Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Thu, 23 Jan 2025 16:19:25 -0800 Subject: PackExt: Add value for the multipack index The code establishing the PackExt from the file name uses endsWith, i think to cover for the x. and x.old- cases. This doesn't work if we add the "midx" case, as "midx".endsWith("idx"). Check explicitely that the extension maches itself or with the old- prefix. We rather keep the "midx" as file extension for upstream compatibility. Change-Id: I25d0e850b9df17ed99d776b397560774bc402d39 --- .../src/org/eclipse/jgit/internal/storage/file/PackFile.java | 6 +++++- .../src/org/eclipse/jgit/internal/storage/pack/PackExt.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java index c9b05ad025..5f2015b834 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java @@ -185,7 +185,11 @@ public class PackFile extends File { private static PackExt getPackExt(String endsWithExtension) { for (PackExt ext : PackExt.values()) { - if (endsWithExtension.endsWith(ext.getExtension())) { + if (endsWithExtension.equals(ext.getExtension())) { + return ext; + } + + if (endsWithExtension.equals("old-" + ext.getExtension())) { return ext; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java index e6daaeaca9..d5bb5f2e2f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java @@ -36,7 +36,10 @@ public enum PackExt { COMMIT_GRAPH("graph"), //$NON-NLS-1$ /** An object size index. */ - OBJECT_SIZE_INDEX("objsize"); //$NON-NLS-1$ + OBJECT_SIZE_INDEX("objsize"), //$NON-NLS-1$ + + /** Multi pack index */ + MULTI_PACK_INDEX("midx"); //$NON-NLS-1$ private final String ext; -- cgit v1.2.3