30 lines
942 B
C++
30 lines
942 B
C++
#pragma once
|
|
#include <filesystem>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <expected>
|
|
|
|
namespace git {
|
|
class Repository {
|
|
public:
|
|
explicit Repository(const std::filesystem::path& in_path);
|
|
|
|
std::expected<std::string, std::string> SwitchBranch(const std::string& in_branch);
|
|
std::expected<std::string, std::string> HardReset();
|
|
std::expected<std::string, std::string> Pull();
|
|
|
|
[[nodiscard]] std::expected<std::vector<std::shared_ptr<Repository>>, std::string> GetSubmodules() const;
|
|
[[nodiscard]] std::expected<std::string, std::string> GetCurrentBranchName() const;
|
|
[[nodiscard]] std::expected<std::vector<std::string>, std::string> GetAllBranches() const;
|
|
[[nodiscard]] auto GetName() const { return name_; }
|
|
|
|
[[nodiscard]] bool IsValid() const;
|
|
private:
|
|
std::string name_;
|
|
std::filesystem::path path_;
|
|
};
|
|
|
|
std::shared_ptr<Repository> OpenRepository(const std::filesystem::path& in_path);
|
|
}
|