diff options
author | Ivan Frade <ifrade@google.com> | 2025-01-23 16:19:25 -0800 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2025-04-15 16:27:24 -0700 |
commit | 2cef1a59ff33fd9829a7fb2bc777f675f5a75f30 (patch) | |
tree | daa81510cb7a21d1fceca2ed7f95e1269f6d508a | |
parent | 9b51ec8f2ff1a118844227c1ea41f0f0fe05e2ef (diff) | |
download | jgit-2cef1a59ff33fd9829a7fb2bc777f675f5a75f30.tar.gz jgit-2cef1a59ff33fd9829a7fb2bc777f675f5a75f30.zip |
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.<ext> and x.old-<ext> 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
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java | 6 | ||||
-rw-r--r-- | org.eclipse.jgit/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; |