[git] IDEA-89296 EA-30807 Rename change may have only 1 path

So don't require it.
For example, in 'git show --name-status -M' for a merge commit, where the file was renamed in one of the branches.
This commit is contained in:
Kirill Likhodedov
2012-07-30 16:05:56 +04:00
parent e76c460aba
commit bf1f731d6d
2 changed files with 6 additions and 4 deletions
@@ -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;
@@ -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