diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java index 39c24c130ec0..5109e61a09ae 100644 --- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java +++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java @@ -593,7 +593,7 @@ public class GitHistoryUtils { output.setLength(0); } output.append(tail); - foundRecordEnd.set(false); + foundRecordEnd.set(tail.contains(GitLogParser.RECORD_END)); } } catch (Exception e) { diff --git a/plugins/git4idea/tests/git4idea/history/GitHistoryUtilsTest.java b/plugins/git4idea/tests/git4idea/history/GitHistoryUtilsTest.java index fe9b0c1835a5..98fe9905781f 100644 --- a/plugins/git4idea/tests/git4idea/history/GitHistoryUtilsTest.java +++ b/plugins/git4idea/tests/git4idea/history/GitHistoryUtilsTest.java @@ -406,6 +406,28 @@ public class GitHistoryUtilsTest extends GitSingleRepoTest { assertEquals(message, lastCommit.getFullMessage()); } + @Test + public void testLoadingDetailsWithoutChanges() throws Exception { + List expected = ContainerUtil.newArrayList(); + + String messageFile = "message.txt"; + touch(messageFile, ""); + + int commitCount = 100; + for (int i = 0; i < commitCount; i++) { + touch("file.txt", "content number " + i); + add(); + git("commit --allow-empty-message -F " + messageFile); + expected.add(last()); + } + expected = ContainerUtil.reverse(expected); + + List actualMessages = + GitHistoryUtils.loadDetails(myProject, myRepo.getRoot(), true, false, GitLogRecord::getHash, "--max-count=" + commitCount); + + assertEquals(expected, actualMessages); + } + private void assertHistory(@NotNull List actualRevisions) throws IOException, VcsException { assertEquals("Incorrect number of commits in history", myRevisions.size(), actualRevisions.size()); for (int i = 0; i < actualRevisions.size(); i++) {