#pragma once #include #include #include #include namespace ks::files { enum class GitChangeKind { staged, unstaged, untracked }; struct GitChange { GitChangeKind kind; std::wstring path; std::wstring oldPath; std::wstring flags; bool operator==(const GitChange &) const = default; }; struct GitCheckout { std::wstring ref, revision; bool operator==(const GitCheckout &) const = default; }; struct GitChanges { std::filesystem::path executable, root; std::vector entries; GitCheckout checkout; }; struct GitBranch { std::wstring ref, label, revision; bool current{}; }; struct GitCommit { std::wstring revision, abbreviated, date, subject; }; struct GitHistoryPage { std::vector commits; bool more{}; }; struct GitCommitReview { std::filesystem::path root; GitCheckout checkout; std::vector staged; std::string stagedIdentity; }; GitChanges readGitChanges(const std::filesystem::path &directory,std::stop_token stop); std::string readGitPatch(const std::filesystem::path &git,const std::filesystem::path &root, const GitChange &change,std::stop_token stop); std::vector readGitBranches(const std::filesystem::path &git,const std::filesystem::path &root, std::stop_token stop); GitHistoryPage readGitHistory(const std::filesystem::path &git,const std::filesystem::path &root, const std::wstring &revision,size_t offset,std::stop_token stop); std::string readGitCommit(const std::filesystem::path &git,const std::filesystem::path &root, const std::wstring &revision,std::stop_token stop); void changeGitIndex(const GitChanges &worktree,const GitChange &entry,bool replaceStaged,std::stop_token stop); GitCommitReview reviewGitCommit(const GitChanges &worktree,std::stop_token stop); std::wstring createGitCommit(const GitChanges &worktree,const GitCommitReview &review, const std::wstring &message,std::stop_token stop); }