35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "breeze/Version.hpp"
|
|
|
|
/// The little of git the CLI needs: listing the version tags of a repository and exporting one
|
|
/// tag's files. Repositories are URLs or local paths; git itself must be installed.
|
|
namespace breeze::git
|
|
{
|
|
|
|
struct Tag
|
|
{
|
|
/// The tag as written in the repository, e.g. "v1.2.0".
|
|
std::string name;
|
|
Version version;
|
|
};
|
|
|
|
/// Is `source` something git can clone (a URL, or a local repository) rather than a plain
|
|
/// directory?
|
|
bool isRepository(const std::string& source);
|
|
|
|
/// The tags of the repository that are versions, in no particular order. Throws Error when the
|
|
/// repository can't be reached.
|
|
std::vector<Tag> versionTags(const std::string& repository);
|
|
|
|
/// Exports the files of `tag` (the default branch's tip when empty) into `destination`, without
|
|
/// the repository's own history.
|
|
void exportTree(const std::string& repository, const std::string& tag,
|
|
const std::filesystem::path& destination);
|
|
|
|
}
|