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
)
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
;
59 CAppUtils::StartExtDiff(tempfile
,file1
,
61 pPath
->GetGitPathString()+_T(":")+rev1
.Left(6)
66 int CGitDiff::Diff(CTGitPath
* pPath
,CTGitPath
* pPath2
, git_revnum_t
& rev1
, git_revnum_t
& rev2
, bool /*blame*/, bool /*unified*/)
69 GetTempPath(temppath
);
75 if(rev1
!= GIT_REV_ZERO
)
77 file1
.Format(_T("%s%s_%s%s"),
79 pPath
->GetBaseFilename(),
81 pPath
->GetFileExtension());
82 title1
= pPath
->GetFileOrDirectoryName()+_T(":")+rev1
.Left(6);
83 cmd
.Format(_T("git.exe cat-file -p %s:\"%s\""),rev1
,pPath
->GetGitPathString());
84 g_Git
.RunLogFile(cmd
,file1
);
87 file1
=g_Git
.m_CurrentDir
+_T("\\")+pPath
->GetWinPathString();
88 title1
.Format( IDS_DIFF_WCNAME
, pPath
->GetFileOrDirectoryName() );
93 if(rev2
!= GIT_REV_ZERO
)
96 file2
.Format(_T("%s%s_%s%s"),
98 pPath2
->GetBaseFilename(),
100 pPath2
->GetFileExtension());
101 title2
= pPath2
->GetFileOrDirectoryName()+_T(":")+rev2
.Left(6);
102 cmd
.Format(_T("git.exe cat-file -p %s:\"%s\""),rev2
,pPath2
->GetGitPathString());
103 g_Git
.RunLogFile(cmd
,file2
);
106 file2
=g_Git
.m_CurrentDir
+_T("\\")+pPath2
->GetWinPathString();
107 title2
.Format( IDS_DIFF_WCNAME
, pPath2
->GetFileOrDirectoryName() );
110 CAppUtils::DiffFlags flags
;
111 CAppUtils::StartExtDiff(file2
,file1
,