aboutsummaryrefslogtreecommitdiff
path: root/libbpkg/manifest.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-02-09 23:57:09 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-12 17:23:38 +0300
commitc76874c5a1e57b4c3dc8d392f29b679d14a1d305 (patch)
treeac5226264355d73c74a1dc2e374b5369f81da02f /libbpkg/manifest.hxx
parentcc2efd2c70b1cdd28c375674c62f9d5f131f6908 (diff)
Add git_reference class
Diffstat (limited to 'libbpkg/manifest.hxx')
-rw-r--r--libbpkg/manifest.hxx50
1 files changed, 37 insertions, 13 deletions
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index 8c20e76..9d19b2c 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -510,22 +510,24 @@ namespace bpkg
// the URL matches the repository type. Throw std::invalid_argument if the
// URL object is a relative local path.
//
- // @@ Note that the repository location string representation may differ
- // from the original URL in the presence of the trailing slash. This
- // may cause problems with some WEB servers that are sensitive to the
- // trailing slash presence/absence. For example:
+ // Note that the repository location string representation may differ from
+ // the original URL in the presence of the trailing slash. This may cause
+ // problems with some WEB servers that are sensitive to the trailing slash
+ // presence/absence. For example:
//
- // $ git clone http://git.sv.gnu.org/r/config.git
- // warning: redirecting to http://git.savannah.gnu.org/r/config.git/
+ // $ git clone http://git.sv.gnu.org/r/config.git
+ // warning: redirecting to http://git.savannah.gnu.org/r/config.git/
//
- // Also note that we disregard the slash presence/absence on multiple
- // levels:
+ // Also note that we disregard the slash presence/absence on multiple
+ // levels:
//
- // - reduce absent path to an empty one in
- // repository_url_traits::translate_scheme() (so a.com/ becomes a.com)
- // - use path::*string() rather than path::*representation() functions
- // in repository_url_traits::translate_*() functions
- // - may append slash in repository_location ctor
+ // - reduce absent path to an empty one in
+ // repository_url_traits::translate_scheme() (so a.com/ becomes a.com)
+ //
+ // - use path::*string() rather than path::*representation() functions
+ // in repository_url_traits::translate_*() functions
+ //
+ // - may append slash in repository_location ctor
//
explicit
repository_location (repository_url, repository_type);
@@ -685,6 +687,28 @@ namespace bpkg
return os << l.string ();
}
+ // Branch and/or commit. At least one of them must be present. If both of
+ // them are present then the commit is expected to belong to the branch
+ // history. Note that the branch member can also denote a tag.
+ //
+ class LIBBPKG_EXPORT git_reference
+ {
+ public:
+ butl::optional<std::string> branch;
+ butl::optional<std::string> commit;
+
+ public:
+ // Parse the [<branch>][@<commit>] repository URL fragment representation.
+ //
+ explicit
+ git_reference (const butl::optional<std::string>&);
+
+ git_reference (butl::optional<std::string> b,
+ butl::optional<std::string> c)
+ : branch (std::move (b)),
+ commit (std::move (c)) {}
+ };
+
enum class repository_role
{
base,