1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

pass path.rel instead of path.abs to gitattr matcher

This commit is contained in:
Brian Camacho 2024-11-17 02:39:47 -05:00
parent 0878e8ff44
commit 24453b79eb

View file

@ -686,9 +686,10 @@ struct GitSourceAccessor : SourceAccessor
const auto contents = readFile(CanonPath(".gitattributes")); const auto contents = readFile(CanonPath(".gitattributes"));
_lfsFetch.init(*repo, contents); _lfsFetch.init(*repo, contents);
}; };
if (_lfsFetch.hasAttribute(path.abs(), "filter")) { auto pathStr = std::string(path.rel());
if (_lfsFetch.hasAttribute(pathStr, "filter", "lfs")) {
StringSink s; StringSink s;
_lfsFetch.fetch(data, path.abs(), s); _lfsFetch.fetch(data, pathStr, s);
return s.s; return s.s;
} }
} }
@ -714,8 +715,10 @@ struct GitSourceAccessor : SourceAccessor
const auto contents = readFile(CanonPath(".gitattributes")); const auto contents = readFile(CanonPath(".gitattributes"));
_lfsFetch.init(*repo, contents); _lfsFetch.init(*repo, contents);
} }
if (_lfsFetch.hasAttribute(path.abs(), "filter")) {
_lfsFetch.fetch(contents, path.abs(), sink); auto pathStr = std::string(path.rel());
if (_lfsFetch.hasAttribute(pathStr, "filter", "lfs")) {
_lfsFetch.fetch(contents, pathStr, sink);
return; return;
} }
} }