From f619db022734dff6b988c514e3a292a5c7babaf0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 22 Feb 2018 15:02:15 +0300 Subject: Invent repository_state() function --- bpkg/manifest-utility.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bpkg/manifest-utility.cxx') diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 27e2553..ed50298 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -4,6 +4,8 @@ #include +#include + #include using namespace std; @@ -124,4 +126,20 @@ namespace bpkg { fail << "failed to guess repository type for '" << s << "': " << e << endf; } + + dir_path + repository_state (const repository_location& l) + { + switch (l.type ()) + { + case repository_type::bpkg: return dir_path (); // No state. + case repository_type::git: + { + return dir_path (sha256 (l.canonical_name ()).abbreviated_string (16)); + } + } + + assert (false); // Can't be here. + return dir_path (); + } } -- cgit v1.1