int GitRev::GetParentFromHash(const CGitHash& hash) { CAutoLocker lock(g_Git.m_critGitDllSec); GIT_COMMIT commit; try { g_Git.CheckAndInitDll(); if (git_get_commit_from_hash(&commit, hash.ToRaw())) { m_sErr = L"git_get_commit_from_hash failed for " + hash.ToString(); return -1; } } catch (char* msg) { m_sErr = L"Could not get parents of commit \"" + hash.ToString() + L"\".\nlibgit reports:\n" + CString(msg); return -1; } this->ParserParentFromCommit(&commit); git_free_commit(&commit); this->m_CommitHash=hash; return 0; }
int GitRev::GetCommitFromHash_withoutLock(const CGitHash& hash) { GIT_COMMIT commit; try { if (git_get_commit_from_hash(&commit, hash.ToRaw())) { m_sErr = L"git_get_commit_from_hash failed for " + hash.ToString(); return -1; } } catch (char * msg) { m_sErr = L"Could not get commit \"" + hash.ToString() + L"\".\nlibgit reports:\n" + CString(msg); return -1; } this->ParserFromCommit(&commit); git_free_commit(&commit); m_sErr.Empty(); return 0; }