19 bool Open(
const std::string& path);
20 bool Init(
const std::string& path,
const std::string& initialBranch =
"main");
23 const std::string& GetPath()
const;
27 const std::vector<GitStatusEntry>& GetStatus()
const;
30 std::string GetCurrentBranch()
const;
31 std::vector<GitBranchInfo> GetBranches()
const;
32 bool CreateBranch(
const std::string& name,
const std::string& sourceOid,
bool checkout);
33 bool DeleteBranch(
const std::string& name,
bool force);
34 bool CheckoutBranch(
const std::string& name);
35 bool CheckoutCommit(
const std::string& oid);
36 bool SetUpstream(
const std::string& branch,
const std::string& remote,
const std::string& remoteBranch);
39 std::vector<GitTagInfo> GetTags()
const;
40 bool CreateTag(
const std::string& name,
const std::string& oid,
bool annotated,
const std::string& message);
41 bool DeleteTag(
const std::string& name);
44 std::vector<GitRemoteInfo> GetRemotes()
const;
45 bool AddRemote(
const std::string& name,
const std::string& url);
46 bool EditRemote(
const std::string& name,
const std::string& url);
47 bool RemoveRemote(
const std::string& name);
50 std::vector<GitCommitInfo> GetCommits(int32_t maxCount,
const std::string& branchFilter =
"")
const;
51 GitCommitInfo GetCommitDetails(
const std::string& oid)
const;
54 GitFileDiff GetWorkingTreeDiff(
const std::string& path)
const;
55 GitFileDiff GetStagedDiff(
const std::string& path)
const;
56 GitFileDiff GetCommitDiff(
const std::string& oid)
const;
59 bool StageFiles(
const std::vector<std::string>& paths);
60 bool UnstageFiles(
const std::vector<std::string>& paths);
61 bool DiscardFiles(
const std::vector<std::string>& paths);
64 bool Commit(
const std::string& summary,
const std::string& body,
bool amend);
66 std::mutex& GetMutex() {
return mRepoMutex; }
69 git_repository* mRepo =
nullptr;
71 std::vector<GitStatusEntry> mCachedStatus;
72 mutable std::mutex mRepoMutex;