mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
Update src/libfetchers/git-utils.cc
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
parent
bd37a70d8f
commit
efd4bf6533
1 changed files with 5 additions and 0 deletions
|
@ -914,11 +914,16 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
|
||||||
auto pathComponents = tokenizeString<std::vector<std::string>>(path, "/");
|
auto pathComponents = tokenizeString<std::vector<std::string>>(path, "/");
|
||||||
if (!prepareDirs(pathComponents, false)) return;
|
if (!prepareDirs(pathComponents, false)) return;
|
||||||
|
|
||||||
|
// We can't just look up the path from the start of the root, since
|
||||||
|
// some parent directories may not have finished yet, so we compute
|
||||||
|
// a relative path that helps us find the right git_tree_builder or object.
|
||||||
auto relTarget = CanonPath(path).parent()->makeRelative(target);
|
auto relTarget = CanonPath(path).parent()->makeRelative(target);
|
||||||
|
|
||||||
auto dir = pendingDirs.rbegin();
|
auto dir = pendingDirs.rbegin();
|
||||||
|
|
||||||
// For each ../ component at the start, go up one directory.
|
// For each ../ component at the start, go up one directory.
|
||||||
|
// CanonPath::makeRelative() always puts all .. elements at the start,
|
||||||
|
// so they're all handled by this loop:
|
||||||
std::string_view relTargetLeft(relTarget);
|
std::string_view relTargetLeft(relTarget);
|
||||||
while (hasPrefix(relTargetLeft, "../")) {
|
while (hasPrefix(relTargetLeft, "../")) {
|
||||||
if (dir == pendingDirs.rend())
|
if (dir == pendingDirs.rend())
|
||||||
|
|
Loading…
Reference in a new issue