From a2b084651909929d58f6b4bc0f3c742d87ee31f6 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 27 Apr 2018 15:53:00 +0300 Subject: Add support for repository fragments --- bpkg/manifest-utility.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'bpkg/manifest-utility.cxx') diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 10a1512..0f64b30 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -137,15 +137,27 @@ namespace bpkg } dir_path - repository_state (const repository_location& l) + repository_state (const repository_location& rl) { - switch (l.type ()) + switch (rl.type ()) { case repository_type::pkg: case repository_type::dir: return dir_path (); // No state. case repository_type::git: { + // Strip the fragment, so all the repository fragments of the same + // git repository can reuse the state. So, for example, the state is + // shared for the fragments fetched from the following git repository + // locations: + // + // https://www.example.com/foo.git#master + // git://example.com/foo#stable + // + repository_url u (rl.url ()); + u.fragment = nullopt; + + repository_location l (u, rl.type ()); return dir_path (sha256 (l.canonical_name ()).abbreviated_string (12)); } } -- cgit v1.1