diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-07-04 22:10:38 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-07-05 08:49:59 +0200 |
commit | 9be433ac34057a2c9c1757ec41f8b3f6361f98dc (patch) | |
tree | 053bc111fd525086c29343195bea595eaca4d43b /bpkg | |
parent | adefc9b14d8940299a0c6b478de8b66566978d10 (diff) |
Strip .git extension for non-existent local prerequisite location
If the local prerequisite git repository having the .git extension doesn't
exist but the one without the extension does, then strip the extension from
the location.
Diffstat (limited to 'bpkg')
-rw-r--r-- | bpkg/rep-fetch.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 2de6a01..b905a7b 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -533,6 +533,27 @@ namespace bpkg << "': " << e << info << "base repository location is " << rl; } + + // If the local prerequisite git repository having the .git extension + // doesn't exist but the one without the extension does, then we + // strip the extension from the location. + // + if (l.local () && + l.type () == repository_type::git && + l.path ().extension () == "git") + { + dir_path d (path_cast<dir_path> (l.path ())); + + if (!exists (d) && exists (d.base () / dir_path (".git"))) + { + repository_url u (l.url ()); + + assert (u.path); + u.path->make_base (); + + l = repository_location (u, l.type ()); + } + } } } } |