From f07fa9f8716d582d3a1fd282dde5f317a62f3664 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Tue, 1 Dec 2009 21:43:37 +0800 Subject: [PATCH] Update index firstly at commit dialog and check modify dialog Signed-off-by: Frank Li --- src/Git/Git.cpp | 10 +++++++++- src/Git/Git.h | 1 + src/TortoiseProc/AppUtils.cpp | 3 +++ src/TortoiseProc/Commands/RepoStatusCommand.cpp | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index 1012e22..46bfb66 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -1294,4 +1294,12 @@ unsigned int CGit::Hash2int(CString &hash) } return ret; -} \ No newline at end of file +} + +int CGit::RefreshGitIndex() +{ + CString cmd,output; + cmd=_T("git.exe update-index --refresh"); + return Run(cmd,&output,CP_ACP); +} + diff --git a/src/Git/Git.h b/src/Git/Git.h index afe98ac..342d5d4 100644 --- a/src/Git/Git.h +++ b/src/Git/Git.h @@ -121,6 +121,7 @@ public: int ListConflictFile(CTGitPathList &list,CTGitPath *path=NULL); int GetRefList(STRING_VECTOR &list); + int RefreshGitIndex(); //Example: master -> refs/heads/master CString GetFullRefName(CString shortRefName); diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index efc9405..9bd8a5a 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -2190,6 +2190,9 @@ BOOL CAppUtils::Commit(CString bugid,BOOL bWholeProject,CString &sLogMsg, BOOL bSelectFilesForCommit) { bool bFailed = true; + + g_Git.RefreshGitIndex(); + while (bFailed) { bFailed = false; diff --git a/src/TortoiseProc/Commands/RepoStatusCommand.cpp b/src/TortoiseProc/Commands/RepoStatusCommand.cpp index 84fdd8e..6efbf1c 100644 --- a/src/TortoiseProc/Commands/RepoStatusCommand.cpp +++ b/src/TortoiseProc/Commands/RepoStatusCommand.cpp @@ -23,6 +23,8 @@ bool RepoStatusCommand::Execute() { + g_Git.RefreshGitIndex(); + CChangedDlg dlg; dlg.m_pathList = pathList; dlg.DoModal(); -- 2.11.0