diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-04-11 11:16:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 11:16:04 +0200 |
commit | f7276bc948705f452b2bfcc2a08bc44152f1d5a8 (patch) | |
tree | 38d96b3af334afcb51e919b485eeb0211f80a409 /src/libfetchers | |
parent | 1f5d8e590e72201561f6b9dadfbfae037b7879b8 (diff) | |
parent | 38125a47ab512446dd78d3d0f1ed2d52e1d9cbd2 (diff) |
Merge pull request #6392 from danpls/fix-actualUrl-mercurial
libfetchers: Fix assertion (Mercurial)
Diffstat (limited to 'src/libfetchers')
-rw-r--r-- | src/libfetchers/mercurial.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libfetchers/mercurial.cc b/src/libfetchers/mercurial.cc index 8b82e9daa..51cf35bf4 100644 --- a/src/libfetchers/mercurial.cc +++ b/src/libfetchers/mercurial.cc @@ -178,9 +178,11 @@ struct MercurialInputScheme : InputScheme auto files = tokenizeString<std::set<std::string>>( runHg({ "status", "-R", actualUrl, "--clean", "--modified", "--added", "--no-status", "--print0" }), "\0"s); + Path actualPath(absPath(actualUrl)); + PathFilter filter = [&](const Path & p) -> bool { - assert(hasPrefix(p, actualUrl)); - std::string file(p, actualUrl.size() + 1); + assert(hasPrefix(p, actualPath)); + std::string file(p, actualPath.size() + 1); auto st = lstat(p); @@ -193,7 +195,7 @@ struct MercurialInputScheme : InputScheme return files.count(file); }; - auto storePath = store->addToStore(input.getName(), actualUrl, FileIngestionMethod::Recursive, htSHA256, filter); + auto storePath = store->addToStore(input.getName(), actualPath, FileIngestionMethod::Recursive, htSHA256, filter); return {std::move(storePath), input}; } |