From 034e63ae380147b21a344cd03a63fd0b5ffc17d5 Mon Sep 17 00:00:00 2001 From: Colin Law Date: Tue, 3 Feb 2009 10:32:40 +0000 Subject: [PATCH] Improvements to Diff of modified version against head Switched the two windows round so head is in left and modified in right. Changed heading to show 'Working Copy' instead of '000000' Removed path from filename in heading. --- src/TortoiseProc/Commands/DiffCommand.cpp | 4 ++-- src/TortoiseProc/GitDiff.cpp | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/TortoiseProc/Commands/DiffCommand.cpp b/src/TortoiseProc/Commands/DiffCommand.cpp index 090615a76..dd081f88e 100644 --- a/src/TortoiseProc/Commands/DiffCommand.cpp +++ b/src/TortoiseProc/Commands/DiffCommand.cpp @@ -29,7 +29,7 @@ bool DiffCommand::Execute() bool bRet = false; CString path2 = CPathUtils::GetLongPathname(parser.GetVal(_T("path2"))); bool bAlternativeTool = !!parser.HasKey(_T("alternative")); - bool bBlame = !!parser.HasKey(_T("blame")); +// bool bBlame = !!parser.HasKey(_T("blame")); if (path2.IsEmpty()) { if (cmdLinePath.IsDirectory()) @@ -54,7 +54,7 @@ bool DiffCommand::Execute() #endif { //git_revnum_t baseRev = 0; - bRet = diff.Diff(&cmdLinePath,&cmdLinePath,git_revnum_t(_T("HEAD")),git_revnum_t(GIT_REV_ZERO)); + bRet = diff.Diff(&cmdLinePath,&cmdLinePath,git_revnum_t(GIT_REV_ZERO),git_revnum_t(_T("HEAD"))); } } } diff --git a/src/TortoiseProc/GitDiff.cpp b/src/TortoiseProc/GitDiff.cpp index 2da12e519..d85f2c33d 100644 --- a/src/TortoiseProc/GitDiff.cpp +++ b/src/TortoiseProc/GitDiff.cpp @@ -2,6 +2,7 @@ #include "GitDiff.h" #include "AppUtils.h" #include "git.h" +#include "resource.h" CGitDiff::CGitDiff(void) { @@ -62,13 +63,14 @@ int CGitDiff::DiffNull(CTGitPath *pPath, git_revnum_t &rev1) return 0; } -int CGitDiff::Diff(CTGitPath * pPath,CTGitPath * pPath2, git_revnum_t & rev1, git_revnum_t & rev2, bool blame, bool unified) +int CGitDiff::Diff(CTGitPath * pPath,CTGitPath * pPath2, git_revnum_t & rev1, git_revnum_t & rev2, bool /*blame*/, bool /*unified*/) { CString temppath; GetTempPath(temppath); Parser(rev1); Parser(rev2); CString file1; + CString title1; CString cmd; if(rev1 != GIT_REV_ZERO ) { @@ -77,14 +79,17 @@ int CGitDiff::Diff(CTGitPath * pPath,CTGitPath * pPath2, git_revnum_t & rev1, gi pPath->GetBaseFilename(), rev1.Left(6), pPath->GetFileExtension()); + title1 = pPath->GetFileOrDirectoryName()+_T(":")+rev1.Left(6); cmd.Format(_T("git.exe cat-file -p %s:%s"),rev1,pPath->GetGitPathString()); g_Git.RunLogFile(cmd,file1); }else { file1=g_Git.m_CurrentDir+_T("\\")+pPath->GetWinPathString(); + title1.Format( IDS_DIFF_WCNAME, pPath->GetFileOrDirectoryName() ); } CString file2; + CString title2; if(rev2 != GIT_REV_ZERO) { @@ -93,23 +98,25 @@ int CGitDiff::Diff(CTGitPath * pPath,CTGitPath * pPath2, git_revnum_t & rev1, gi pPath2->GetBaseFilename(), rev2.Left(6), pPath2->GetFileExtension()); + title2 = pPath2->GetFileOrDirectoryName()+_T(":")+rev2.Left(6); cmd.Format(_T("git.exe cat-file -p %s:%s"),rev2,pPath2->GetGitPathString()); g_Git.RunLogFile(cmd,file2); }else { file2=g_Git.m_CurrentDir+_T("\\")+pPath2->GetWinPathString(); + title2.Format( IDS_DIFF_WCNAME, pPath2->GetFileOrDirectoryName() ); } CAppUtils::DiffFlags flags; CAppUtils::StartExtDiff(file2,file1, - pPath2->GetGitPathString()+_T(":")+rev2.Left(6), - pPath->GetGitPathString()+_T(":")+rev1.Left(6) + title2, + title1 ,flags); return 0; } -int CGitDiff::StartConflictEditor(CTGitPath* file) +int CGitDiff::StartConflictEditor(CTGitPath* /*file*/) { return 0; } \ No newline at end of file -- 2.11.4.GIT