diff --git a/src/main/java/org/craftercms/studio/api/v2/repository/GitContentRepository.java b/src/main/java/org/craftercms/studio/api/v2/repository/GitContentRepository.java index 606eb605ab..b484f88377 100644 --- a/src/main/java/org/craftercms/studio/api/v2/repository/GitContentRepository.java +++ b/src/main/java/org/craftercms/studio/api/v2/repository/GitContentRepository.java @@ -195,7 +195,7 @@ void forAllSitePaths(String siteId, * @throws IOException if there is any error reading the git log or getting diffs between commits * @throws GitAPIException if there is any error while executing git commands */ - List getContentItemHistory(String site, String path) throws IOException, GitAPIException; + List getContentItemHistory(String site, String path) throws IOException, GitAPIException, ServiceLayerException; /** * Get the commits between two commit ids. diff --git a/src/main/java/org/craftercms/studio/impl/v2/repository/GitContentRepositoryImpl.java b/src/main/java/org/craftercms/studio/impl/v2/repository/GitContentRepositoryImpl.java index 2dc0dabd39..ea2fb414f3 100644 --- a/src/main/java/org/craftercms/studio/impl/v2/repository/GitContentRepositoryImpl.java +++ b/src/main/java/org/craftercms/studio/impl/v2/repository/GitContentRepositoryImpl.java @@ -1315,6 +1315,10 @@ public List getContentItemHistory(String site, String path) throws // Set this after the diff entry is retrieved, so that the old path is set correctly version.setOldPath(prependIfMissing(currentPath, FILE_SEPARATOR)); versionHistory.add(version); + if (currentPath == null) { + // We have reached the latest creation of a file in this path + break; + } } } finally { generalLockService.unlock(repoLockKey); diff --git a/src/main/java/org/craftercms/studio/impl/v2/repository/blob/BlobAwareContentRepository.java b/src/main/java/org/craftercms/studio/impl/v2/repository/blob/BlobAwareContentRepository.java index 5e63131c2d..66f1c604f4 100644 --- a/src/main/java/org/craftercms/studio/impl/v2/repository/blob/BlobAwareContentRepository.java +++ b/src/main/java/org/craftercms/studio/impl/v2/repository/blob/BlobAwareContentRepository.java @@ -378,7 +378,7 @@ public VersionTO[] getContentVersionHistory(String site, String path) { } @Override - public List getContentItemHistory(String site, String path) { + public List getContentItemHistory(String site, String path) throws GitAPIException, ServiceLayerException, IOException { logger.debug("Get version history for site '{}' path '{}'", site, path); try { if (pointersExist(site, path)) { @@ -390,7 +390,7 @@ public List getContentItemHistory(String site, String path) { return localRepositoryV2.getContentItemHistory(site, path); } catch (Exception e) { logger.error("Failed to get version history for site '{}' path '{}'", site, path, e); - return null; + throw e; } }