1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-28 13:11:00 +01:00
This commit is contained in:
Graham Dennis 2025-09-15 13:55:38 +10:00
parent f743e935a7
commit 0e2e1d3af4
3 changed files with 19 additions and 27 deletions

View file

@ -509,8 +509,12 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
*/ */
ref<GitSourceAccessor> getRawAccessor(const Hash & rev, bool smudgeLfs = false, bool applyFilters = false); ref<GitSourceAccessor> getRawAccessor(const Hash & rev, bool smudgeLfs = false, bool applyFilters = false);
ref<SourceAccessor> ref<SourceAccessor> getAccessor(
getAccessor(const Hash & rev, bool exportIgnore, std::string displayPrefix, bool smudgeLfs = false, bool applyFilters = false) override; const Hash & rev,
bool exportIgnore,
std::string displayPrefix,
bool smudgeLfs = false,
bool applyFilters = false) override;
ref<SourceAccessor> getAccessor(const WorkdirInfo & wd, bool exportIgnore, MakeNotAllowedError e) override; ref<SourceAccessor> getAccessor(const WorkdirInfo & wd, bool exportIgnore, MakeNotAllowedError e) override;
@ -742,7 +746,7 @@ struct GitSourceAccessor : SourceAccessor
int error = git_blob_filter(&filtered, blob.get(), path.rel_c_str(), &opts); int error = git_blob_filter(&filtered, blob.get(), path.rel_c_str(), &opts);
if (error != 0) { if (error != 0) {
const git_error *e = git_error_last(); const git_error * e = git_error_last();
std::string errorMsg = e ? e->message : "Unknown error"; std::string errorMsg = e ? e->message : "Unknown error";
git_buf_dispose(&filtered); git_buf_dispose(&filtered);
throw Error("Failed to filter blob: " + errorMsg); throw Error("Failed to filter blob: " + errorMsg);
@ -1259,8 +1263,8 @@ ref<GitSourceAccessor> GitRepoImpl::getRawAccessor(const Hash & rev, bool smudge
return make_ref<GitSourceAccessor>(self, rev, smudgeLfs, applyFilters); return make_ref<GitSourceAccessor>(self, rev, smudgeLfs, applyFilters);
} }
ref<SourceAccessor> ref<SourceAccessor> GitRepoImpl::getAccessor(
GitRepoImpl::getAccessor(const Hash & rev, bool exportIgnore, std::string displayPrefix, bool smudgeLfs, bool applyFilters) const Hash & rev, bool exportIgnore, std::string displayPrefix, bool smudgeLfs, bool applyFilters)
{ {
auto self = ref<GitRepoImpl>(shared_from_this()); auto self = ref<GitRepoImpl>(shared_from_this());
ref<GitSourceAccessor> rawGitAccessor = getRawAccessor(rev, smudgeLfs, applyFilters); ref<GitSourceAccessor> rawGitAccessor = getRawAccessor(rev, smudgeLfs, applyFilters);

View file

@ -199,25 +199,9 @@ struct GitInputScheme : InputScheme
StringSet allowedAttrs() const override StringSet allowedAttrs() const override
{ {
return { return {
"url", "url", "ref", "rev", "shallow", "submodules", "lfs", "exportIgnore",
"ref", "lastModified", "revCount", "narHash", "allRefs", "name", "dirtyRev", "dirtyShortRev",
"rev", "verifyCommit", "keytype", "publicKey", "publicKeys", "applyFilters",
"shallow",
"submodules",
"lfs",
"exportIgnore",
"lastModified",
"revCount",
"narHash",
"allRefs",
"name",
"dirtyRev",
"dirtyShortRev",
"verifyCommit",
"keytype",
"publicKey",
"publicKeys",
"applyFilters",
}; };
} }

View file

@ -88,8 +88,12 @@ struct GitRepo
virtual bool hasObject(const Hash & oid) = 0; virtual bool hasObject(const Hash & oid) = 0;
virtual ref<SourceAccessor> virtual ref<SourceAccessor> getAccessor(
getAccessor(const Hash & rev, bool exportIgnore, std::string displayPrefix, bool smudgeLfs = false, bool applyFilters = false) = 0; const Hash & rev,
bool exportIgnore,
std::string displayPrefix,
bool smudgeLfs = false,
bool applyFilters = false) = 0;
virtual ref<SourceAccessor> virtual ref<SourceAccessor>
getAccessor(const WorkdirInfo & wd, bool exportIgnore, MakeNotAllowedError makeNotAllowedError) = 0; getAccessor(const WorkdirInfo & wd, bool exportIgnore, MakeNotAllowedError makeNotAllowedError) = 0;