@@ -641,25 +641,28 @@ void LocalStore::queryPathInfoUncached(const StorePath & path,
641641 Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept
642642{
643643 try {
644- auto info = std::make_shared<ValidPathInfo>(path);
645-
646644 callback (retrySQLite<std::shared_ptr<ValidPathInfo>>([&]() {
647645 auto state (_state.lock ());
648646
649647 /* Get the path info. */
650- auto useQueryPathInfo (state->stmtQueryPathInfo .use ()(printStorePath (info-> path )));
648+ auto useQueryPathInfo (state->stmtQueryPathInfo .use ()(printStorePath (path)));
651649
652650 if (!useQueryPathInfo.next ())
653651 return std::shared_ptr<ValidPathInfo>();
654652
655- info-> id = useQueryPathInfo.getInt (0 );
653+ auto id = useQueryPathInfo.getInt (0 );
656654
655+ auto narHash = Hash::dummy;
657656 try {
658- info-> narHash = Hash::parseAnyPrefixed (useQueryPathInfo.getStr (1 ));
657+ narHash = Hash::parseAnyPrefixed (useQueryPathInfo.getStr (1 ));
659658 } catch (BadHash & e) {
660- throw Error (" in valid -path entry for '%s': %s" , printStorePath (path), e.what ());
659+ throw Error (" invalid -path entry for '%s': %s" , printStorePath (path), e.what ());
661660 }
662661
662+ auto info = std::make_shared<ValidPathInfo>(path, narHash);
663+
664+ info->id = id;
665+
663666 info->registrationTime = useQueryPathInfo.getInt (2 );
664667
665668 auto s = (const char *) sqlite3_column_text (state->stmtQueryPathInfo , 3 );
@@ -1152,8 +1155,7 @@ StorePath LocalStore::addToStoreFromDump(Source & source0, const string & name,
11521155
11531156 optimisePath (realPath);
11541157
1155- ValidPathInfo info (dstPath);
1156- info.narHash = narHash.first ;
1158+ ValidPathInfo info { dstPath, narHash.first };
11571159 info.narSize = narHash.second ;
11581160 info.ca = FixedOutputHash { .method = method, .hash = hash };
11591161 registerValidPath (info);
@@ -1196,8 +1198,7 @@ StorePath LocalStore::addTextToStore(const string & name, const string & s,
11961198
11971199 optimisePath (realPath);
11981200
1199- ValidPathInfo info (dstPath);
1200- info.narHash = narHash;
1201+ ValidPathInfo info { dstPath, narHash };
12011202 info.narSize = sink.s ->size ();
12021203 info.references = references;
12031204 info.ca = TextHash { .hash = hash };
0 commit comments