1、修复TryGetDetectedBranch问题
2、修复TryGetBranchCommitCountByDate在游离状态下获取分支失败的问题,应当获取远程分支,如:origin/master 但当浅克隆仓库,本地从未拉取过 origin/master,需要先执行:git fetch origin/master 3、更新md文件
This commit is contained in:
@@ -38,7 +38,9 @@ BOOL TryGetCurrentBranch(LPCTSTR lpRepoPath, CString& strBranch)
|
||||
BOOL TryGetDetectedBranch(LPCTSTR lpRepoPath, CString& strBranch)
|
||||
{
|
||||
// 远程仓库名必须以 origin 开头;
|
||||
strBranch = StartProcess(NULL, _T("cmd /c git branch -r --contains HEAD | head -n1 | sed 's/.*origin\\///'"), lpRepoPath);
|
||||
// "C:\Program Files\Git\bin\bash.exe" -c "git branch -r --contains HEAD | head -n1 | sed 's/.*origin\///'"
|
||||
strBranch = StartProcess(NULL, _T("\"C:\\Program Files\\Git\\bin\\bash.exe\" -c \"git branch -r --contains HEAD | head -n1 | sed 's/.*origin\\///'\""), lpRepoPath);
|
||||
//strBranch = StartProcess("C:\\Program Files\\Git\\bin\\bash.exe", _T("git branch -r --contains HEAD | head -n1 | sed 's/.*origin\\///'"), lpRepoPath);
|
||||
strBranch.Replace(_T("\r"), _T(""));
|
||||
strBranch.Replace(_T("\n"), _T(""));
|
||||
strBranch.Trim();
|
||||
@@ -202,7 +204,7 @@ BOOL TryGetBranchCommitCountByDate(LPCTSTR lpRepoPath, const CString& strBranch,
|
||||
|
||||
CString strCmd;
|
||||
strCmd.Format(
|
||||
_T("cmd /c git rev-list --count --since=\"%s 00:00:00\" --until=\"%s 23:59:59\" \"%s\""),
|
||||
_T("cmd /c git rev-list --count --since=\"%s 00:00:00\" --until=\"%s 23:59:59\" \"origin/%s\""),
|
||||
strDate.GetString(),
|
||||
strDate.GetString(),
|
||||
strBranch.GetString());
|
||||
|
||||
Reference in New Issue
Block a user