diff --git a/src/libfetchers/git-utils.cc b/src/libfetchers/git-utils.cc index 4dc749504..d8a4f1778 100644 --- a/src/libfetchers/git-utils.cc +++ b/src/libfetchers/git-utils.cc @@ -52,6 +52,8 @@ bool operator == (const git_oid & oid1, const git_oid & oid2) namespace nix { +struct GitInputAccessor; + // Some wrapper types that ensure that the git_*_free functions get called. template struct Deleter @@ -342,6 +344,11 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this return true; } + /** + * A 'GitInputAccessor' with no regard for export-ignore or any other transformations. + */ + ref getRawAccessor(const Hash & rev); + ref getAccessor(const Hash & rev, bool exportIgnore) override; static int sidebandProgressCallback(const char * str, int len, void * payload) @@ -685,6 +692,12 @@ struct GitInputAccessor : InputAccessor } }; +ref GitRepoImpl::getRawAccessor(const Hash & rev) +{ + auto self = ref(shared_from_this()); + return make_ref(self, rev); +} + ref GitRepoImpl::getAccessor(const Hash & rev, bool exportIgnore) { return make_ref(ref(shared_from_this()), rev, exportIgnore); @@ -706,8 +719,10 @@ std::vector> GitRepoImpl::getSubmodules std::vector> result; + auto rawAccessor = getRawAccessor(rev); + for (auto & submodule : parseSubmodules(CanonPath(pathTemp))) { - auto rev = accessor.dynamic_pointer_cast()->getSubmoduleRev(submodule.path); + auto rev = rawAccessor->getSubmoduleRev(submodule.path); result.push_back({std::move(submodule), rev}); }