Sorting of file lists again (if wrong order in cached archive).
| | |
| | | |
| | | @Getter |
| | | private Archive archive; |
| | | private List<BorgFilesystemItem> content; |
| | | |
| | | public void save(BorgRepoConfig repoConfig, Archive archive, List<BorgFilesystemItem> filesystemItems) { |
| | | File file = getFile(repoConfig, archive); |
| | |
| | | } catch (IOException | ClassNotFoundException ex) { |
| | | log.error("Error while reading file list '" + file.getAbsolutePath() + "': " + ex.getMessage(), ex); |
| | | } |
| | | Collections.sort(list); // Sort by path (if archive list order wasn't correct). |
| | | log.info("Loading done."); |
| | | if (filter != null) { |
| | | return filter.reduce(list); |
| | |
| | | } |
| | | } |
| | | list = filter.reduce(list); |
| | | assertEquals(2, list.size()); |
| | | assertEquals(4, list.size()); |
| | | assertEquals(".bashrc", list.get(0).getDisplayPath()); |
| | | assertEquals(".borgbutler", list.get(1).getDisplayPath()); |
| | | |
| | | } |
| | | |
| | |
| | | private List<BorgFilesystemItem> createList() { |
| | | List<BorgFilesystemItem> list = new ArrayList<>(); |
| | | list.add(create("home", true)); |
| | | list.add(create("home/.bashrc", false)); |
| | | list.add(create("home/.borgbutler", true)); |
| | | list.add(create("home/admin", false)); |
| | | list.add(create("home/kai", true)); |
| | | list.add(create("home/kai/borg/cache", false)); |