diff --git a/plugins/git4idea/src/git4idea/history/GitLogRecord.java b/plugins/git4idea/src/git4idea/history/GitLogRecord.java index f1224cae23e7..dcc91c985a9e 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogRecord.java +++ b/plugins/git4idea/src/git4idea/history/GitLogRecord.java @@ -235,7 +235,9 @@ class GitLogRecord { break; case RENAMED: status = FileStatus.MODIFIED; - final FilePath filePathAfterRename = GitContentRevision.createPath(vcsRoot, statusInfo.getSecondPath(), false, false, true); + String secondPath = statusInfo.getSecondPath(); + final FilePath filePathAfterRename = GitContentRevision.createPath(vcsRoot, secondPath == null ? path : secondPath, + false, false, true); after = GitContentRevision.createMultipleParentsRevision(project, filePathAfterRename, parentRevisions); before = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, true, true, true); break; diff --git a/plugins/git4idea/src/git4idea/history/GitLogStatusInfo.java b/plugins/git4idea/src/git4idea/history/GitLogStatusInfo.java index 5dd30712ca6e..c9ac235acd80 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogStatusInfo.java +++ b/plugins/git4idea/src/git4idea/history/GitLogStatusInfo.java @@ -43,11 +43,11 @@ class GitLogStatusInfo { * SecondPath == null iff it the type is rename */ private static void verifyParameters(@NotNull GitChangeType type, @NotNull String path, @Nullable String secondPath) { - if (type.requiresSecondPath()) { - LOG.assertTrue(secondPath != null, String.format("Rename change should have the second path. type=%s, path1=%s, path2=%s", type, path, secondPath)); - } else { + if (!type.requiresSecondPath()) { LOG.assertTrue(secondPath == null, String.format("Second path should be null. type=%s, path1=%s, path2=%s", type, path, secondPath)); } + // rename change doesn't require the second path: + // for example, if it is a merge commit when the file was renamed in one and only one of the branches } @NotNull