7 CGitDiff::CGitDiff(void)
11 CGitDiff::~CGitDiff(void)
14 int CGitDiff::Parser(git_revnum_t
&rev
)
16 if(rev
== GIT_REV_ZERO
)
18 if(rev
.GetLength() > 40)
21 cmd
.Format(_T("git.exe rev-parse %s"),rev
);
23 if(!g_Git
.Run(cmd
,&output
,CP_UTF8
))
25 //int start=output.Find(_T('\n'));
31 int CGitDiff::DiffNull(CTGitPath
*pPath
, git_revnum_t
&rev1
,bool bIsAdd
)
34 GetTempPath(temppath
);
39 if(rev1
!= GIT_REV_ZERO
)
41 file1
.Format(_T("%s%s_%s%s"),
43 pPath
->GetBaseFilename(),
45 pPath
->GetFileExtension());
46 cmd
.Format(_T("git.exe cat-file -p %s:\"%s\""),rev1
,pPath
->GetGitPathString());
47 g_Git
.RunLogFile(cmd
,file1
);
50 file1
=g_Git
.m_CurrentDir
+_T("\\")+pPath
->GetWinPathString();
53 CString tempfile
=::GetTempFile();
54 CStdioFile
file(tempfile
,CFile::modeReadWrite
|CFile::modeCreate
);
58 CAppUtils::DiffFlags flags
;
61 CAppUtils::StartExtDiff(tempfile
,file1
,
63 pPath
->GetGitPathString()+_T(":")+rev1
.Left(6)
66 CAppUtils::StartExtDiff(file1
,tempfile
,
67 pPath
->GetGitPathString()+_T(":")+rev1
.Left(6)
73 int CGitDiff::Diff(CTGitPath
* pPath
,CTGitPath
* pPath2
, git_revnum_t
& rev1
, git_revnum_t
& rev2
, bool /*blame*/, bool /*unified*/)
76 GetTempPath(temppath
);
82 if(rev1
!= GIT_REV_ZERO
)
84 file1
.Format(_T("%s%s_%s%s"),
86 pPath
->GetBaseFilename(),
88 pPath
->GetFileExtension());
89 title1
= pPath
->GetFileOrDirectoryName()+_T(":")+rev1
.Left(6);
90 cmd
.Format(_T("git.exe cat-file -p %s:\"%s\""),rev1
,pPath
->GetGitPathString());
91 g_Git
.RunLogFile(cmd
,file1
);
94 file1
=g_Git
.m_CurrentDir
+_T("\\")+pPath
->GetWinPathString();
95 title1
.Format( IDS_DIFF_WCNAME
, pPath
->GetFileOrDirectoryName() );
100 if(rev2
!= GIT_REV_ZERO
)
103 file2
.Format(_T("%s%s_%s%s"),
105 pPath2
->GetBaseFilename(),
107 pPath2
->GetFileExtension());
108 title2
= pPath2
->GetFileOrDirectoryName()+_T(":")+rev2
.Left(6);
109 cmd
.Format(_T("git.exe cat-file -p %s:\"%s\""),rev2
,pPath2
->GetGitPathString());
110 g_Git
.RunLogFile(cmd
,file2
);
113 file2
=g_Git
.m_CurrentDir
+_T("\\")+pPath2
->GetWinPathString();
114 title2
.Format( IDS_DIFF_WCNAME
, pPath2
->GetFileOrDirectoryName() );
117 CAppUtils::DiffFlags flags
;
118 CAppUtils::StartExtDiff(file2
,file1
,