bool CHooks::StartUpdate(const CTGitPathList& pathList, DWORD& exitcode, CString& error) { hookiterator it = FindItem(start_update_hook, pathList); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow); return true; }
bool CHooks::PreUpdate(const CTGitPathList& pathList, git_depth_t depth, GitRev rev, DWORD& exitcode, CString& error) { hookiterator it = FindItem(pre_update_hook, pathList); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); AddDepthParam(sCmd, depth); AddParam(sCmd, rev.m_CommitHash.ToString()); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow); return true; }
bool CHooks::PreCommit(const CTGitPathList& pathList, git_depth_t depth, const CString& message, DWORD& exitcode, CString& error) { hookiterator it = FindItem(pre_commit_hook, pathList); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); AddDepthParam(sCmd, depth); AddMessageFileParam(sCmd, message); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow); return true; }
bool CHooks::StartCommit(const CTGitPathList& pathList, CString& message, DWORD& exitcode, CString& error) { hookiterator it = FindItem(start_commit_hook, pathList); if (it == end()) return false; CString sCmd = it->second.commandline; AddPathParam(sCmd, pathList); CTGitPath temppath = AddMessageFileParam(sCmd, message); AddCWDParam(sCmd, pathList); exitcode = RunScript(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPath(), error, it->second.bWait, it->second.bShow); if (!exitcode && !temppath.IsEmpty()) { CStringUtils::ReadStringFromTextFile(temppath.GetWinPathString(), message); } return true; }
void CHooks::AddCWDParam(CString& sCmd, const CTGitPathList& pathList) { AddParam(sCmd, pathList.GetCommonRoot().GetDirectory().GetWinPathString()); }