From 3ad0fb5cca5de780363ed37632444448a91f1b04 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 10 Dec 2011 15:51:36 +0100 Subject: [PATCH] Fixed issue #996: Compare with Working Copy error on renamed files Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/TortoiseProc/GitDiff.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index 53474522a..1dcde3be3 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -33,6 +33,7 @@ * Fixed issue #920: TortoiseGitBlame and UTF-16 LE * updated documentation * Fixed issue #994: Git clone from SVN - Depth field is useless + * Fixed issue #996: Compare with Working Copy error on renamed files = Release 1.7.5.0 = == Features== diff --git a/src/TortoiseProc/GitDiff.cpp b/src/TortoiseProc/GitDiff.cpp index f9e9a70c8..1f7f94e83 100644 --- a/src/TortoiseProc/GitDiff.cpp +++ b/src/TortoiseProc/GitDiff.cpp @@ -302,14 +302,18 @@ int CGitDiff::Diff(CTGitPath * pPath,CTGitPath * pPath2, git_revnum_t rev1, git_ CString temp(szTempName); DeleteFile(szTempName); CreateDirectory(szTempName, NULL); + CTGitPath fileName = *pPath2; + if (rev1 == GIT_REV_ZERO && pPath2->m_Action & CTGitPath::LOGACTIONS_REPLACED) + fileName = CTGitPath(pPath2->GetGitOldPathString()); + // use original file extension, an external diff tool might need it file2.Format(_T("%s\\%s-%s-left%s"), temp, - pPath2->GetBaseFilename(), + fileName.GetBaseFilename(), rev2.Left(6), - pPath2->GetFileExtension()); - title2 = pPath2->GetFileOrDirectoryName()+_T(":")+rev2.Left(6); - g_Git.GetOneFile(rev2,*pPath2,file2); + fileName.GetFileExtension()); + title2 = fileName.GetFileOrDirectoryName() + _T(":") + rev2.Left(6); + g_Git.GetOneFile(rev2, fileName, file2); ::SetFileAttributes(file2, FILE_ATTRIBUTE_READONLY); } else -- 2.11.4.GIT