]> source.dussan.org Git - jgit.git/commit
Fix handling of missing pack index file 52/205552/4
authorDariusz Luksza <dariusz.luksza@gmail.com>
Mon, 20 Nov 2023 11:00:51 +0000 (11:00 +0000)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 28 Jan 2024 15:47:48 +0000 (16:47 +0100)
commite0910eda3ea1c474b4cf9b00ac698f739a982f8c
treeee35101eb6a4b7c963815a9825adb921b9605148
parentc646649257070cd1707b7e86887e50c5acafa86c
Fix handling of missing pack index file

As demonstrated in
`UploadPackHandleDeletedPackFile.testV2IdxFileRemovedDuringUploadPack`
the fetch operation will fail when the pack index file is removed.

This is due to a wrapping of `FileNotFoundException` (which is a
subclass of `IOExeption`) in an `IOException` at PackIndex L#68. This
is then changing the behaviour of error handling in
`Pack.file.getBitmapIndex()` where the `FileNotFoundException` is
swallowed and allows the fetch process to continue. With FNFE being
wrapped in IOE, this blows up and breaks the fetch operation.

Simply rethrowing `FileNotFoundException` from `PackFile.open()` fixes
the broken fetch operation. This will also mark the whole pack as
invalid in the `IOException` handler in `Pack.idx()` method.

Change-Id: Ibe321aa1af21d26500e1cb2eb3464cc99a6dbc62
Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackHandleDeletedPackFileTest.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java