From db5877345f199d8ef737218928d1bcc7c3aeee6c Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Sun, 29 Jun 2014 00:46:15 +0800 Subject: [PATCH] Use more CGit::CombinePath() to refactor code Signed-off-by: Sup Yut Sum --- src/Git/GitStatusListCtrl.cpp | 8 ++++---- src/TortoiseProc/AppUtils.cpp | 4 ++-- src/TortoiseProc/GitDiff.cpp | 8 ++++---- src/Utils/ShellUpdater.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index ac32f2a88..7ff790172 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -2053,7 +2053,7 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) case IDGITLC_BLAME: { - CAppUtils::LaunchTortoiseBlame(g_Git.m_CurrentDir+_T("\\")+filepath->GetWinPath(), m_CurrentVersion); + CAppUtils::LaunchTortoiseBlame(g_Git.CombinePath(filepath), m_CurrentVersion); } break; @@ -2305,7 +2305,7 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) && (!(entry->m_Action& CTGitPath::LOGACTIONS_REPLACED)) && !entry->IsDirectory()) { CTGitPath fullpath; - fullpath.SetFromWin(g_Git.m_CurrentDir+_T("\\")+entry->GetWinPath()); + fullpath.SetFromWin(g_Git.CombinePath(entry)); delList.AddPath(fullpath); } } @@ -2970,7 +2970,7 @@ CString CGitStatusListCtrl::GetCommonDirectory(bool bStrict) } } } - return g_Git.m_CurrentDir+CString(_T("\\"))+commonBaseDirectory.GetWinPath(); + return g_Git.CombinePath(commonBaseDirectory); } @@ -4346,7 +4346,7 @@ void CGitStatusListCtrl::FileSaveAs(CTGitPath *path) filename = dlg.GetPathName(); if(m_CurrentVersion == GIT_REV_ZERO) { - if(!CopyFile(g_Git.m_CurrentDir +_T("\\") + path->GetWinPath(),filename,false)) + if(!CopyFile(g_Git.CombinePath(path), filename, false)) { MessageBox(CFormatMessageWrapper(), _T("TortoiseGit"), MB_OK | MB_ICONERROR); return; diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index 6c45fb8be..ae1bef897 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -1490,7 +1490,7 @@ void CAppUtils::RemoveTempMergeFile(CTGitPath &path) CString CAppUtils::GetMergeTempFile(CString type,CTGitPath &merge) { CString file; - file=g_Git.m_CurrentDir+_T("\\") + merge.GetWinPathString()+_T(".")+type+merge.GetFileExtension(); + file = g_Git.CombinePath(merge.GetWinPathString() + _T(".") + type + merge.GetFileExtension()); return file; } @@ -1653,7 +1653,7 @@ bool CAppUtils::ConflictEdit(CTGitPath& path, bool /*bAlternativeTool = false*/, if(b_local && b_remote ) { - merge.SetFromWin(g_Git.m_CurrentDir+_T("\\")+merge.GetWinPathString()); + merge.SetFromWin(g_Git.CombinePath(merge)); if( revertTheirMy ) bRet = !!CAppUtils::StartExtMerge(base, mine, theirs, merge, _T("BASE"), _T("REMOTE"), _T("LOCAL"), CString(), false, resolveMsgHwnd); else diff --git a/src/TortoiseProc/GitDiff.cpp b/src/TortoiseProc/GitDiff.cpp index 05344f338..f15879c53 100644 --- a/src/TortoiseProc/GitDiff.cpp +++ b/src/TortoiseProc/GitDiff.cpp @@ -63,7 +63,7 @@ int CGitDiff::SubmoduleDiffNull(const CTGitPath * pPath, const git_revnum_t &rev newhash=output.Mid(start+1, 40); CGit subgit; - subgit.m_CurrentDir=g_Git.m_CurrentDir+_T("\\")+pPath->GetWinPathString(); + subgit.m_CurrentDir = g_Git.CombinePath(pPath); int encode=CAppUtils::GetLogOutputEncode(&subgit); cmd.Format(_T("git.exe log -n1 --pretty=format:\"%%s\" %s --"), newhash); @@ -146,7 +146,7 @@ int CGitDiff::DiffNull(const CTGitPath *pPath, git_revnum_t rev1, bool bIsAdd, i } else { - file1=g_Git.m_CurrentDir+_T("\\")+pPath->GetWinPathString(); + file1 = g_Git.CombinePath(pPath); } // preserve FileExtension, needed especially for diffing deleted images (detection on new filename extension) @@ -274,7 +274,7 @@ int CGitDiff::SubmoduleDiff(const CTGitPath * pPath, const CTGitPath * /*pPath2* bool oldOK = false, newOK = false; CGit subgit; - subgit.m_CurrentDir=g_Git.m_CurrentDir+_T("\\")+pPath->GetWinPathString(); + subgit.m_CurrentDir = g_Git.CombinePath(pPath); CSubmoduleDiffDlg::ChangeType changeType = CSubmoduleDiffDlg::Unknown; if(pPath->HasAdminDir()) @@ -472,7 +472,7 @@ int CGitDiff::Diff(const CTGitPath * pPath, const CTGitPath * pPath2, git_revnum } else { - file2=g_Git.m_CurrentDir+_T("\\")+pPath2->GetWinPathString(); + file2 = g_Git.CombinePath(pPath2); title2.Format( IDS_DIFF_WCNAME, pPath2->GetFileOrDirectoryName() ); } diff --git a/src/Utils/ShellUpdater.cpp b/src/Utils/ShellUpdater.cpp index 9911abe65..29c16f00e 100644 --- a/src/Utils/ShellUpdater.cpp +++ b/src/Utils/ShellUpdater.cpp @@ -119,7 +119,7 @@ void CShellUpdater::UpdateShell() CTGitPath path; for(int nPath = 0; nPath < m_pathsForUpdating.GetCount(); ++nPath) { - path.SetFromWin(g_Git.m_CurrentDir+_T("\\")+m_pathsForUpdating[nPath].GetWinPathString()); + path.SetFromWin(g_Git.CombinePath(m_pathsForUpdating[nPath])); CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": Cache Item Update for %s (%d)\n"), path.GetWinPathString(), GetTickCount()); if (!path.IsDirectory()) { -- 2.11.4.GIT