@@ -331,7 +331,7 @@ struct GitInputScheme : InputScheme
331331
332332 auto result = runProgram (RunOptions {
333333 .program = " git" ,
334- .args = {" -C" , * repoPath, " --git-dir" , repoInfo.gitDir , " check-ignore" , " --quiet" , std::string (path.rel ())},
334+ .args = {" -C" , repoPath-> string () , " --git-dir" , repoInfo.gitDir , " check-ignore" , " --quiet" , std::string (path.rel ())},
335335 });
336336 auto exitCode =
337337#ifndef WIN32 // TODO abstract over exit status handling on Windows
@@ -344,15 +344,15 @@ struct GitInputScheme : InputScheme
344344 if (exitCode != 0 ) {
345345 // The path is not `.gitignore`d, we can add the file.
346346 runProgram (" git" , true ,
347- { " -C" , * repoPath, " --git-dir" , repoInfo.gitDir , " add" , " --intent-to-add" , " --" , std::string (path.rel ()) });
347+ { " -C" , repoPath-> string () , " --git-dir" , repoInfo.gitDir , " add" , " --intent-to-add" , " --" , std::string (path.rel ()) });
348348
349349
350350 if (commitMsg) {
351351 // Pause the logger to allow for user input (such as a gpg passphrase) in `git commit`
352352 logger->pause ();
353353 Finally restoreLogger ([]() { logger->resume (); });
354354 runProgram (" git" , true ,
355- { " -C" , * repoPath, " --git-dir" , repoInfo.gitDir , " commit" , std::string (path.rel ()), " -F" , " -" },
355+ { " -C" , repoPath-> string () , " --git-dir" , repoInfo.gitDir , " commit" , std::string (path.rel ()), " -F" , " -" },
356356 *commitMsg);
357357 }
358358 }
@@ -470,7 +470,7 @@ struct GitInputScheme : InputScheme
470470 return repoInfo;
471471 }
472472
473- uint64_t getLastModified (const RepoInfo & repoInfo, const std::string & repoDir, const Hash & rev) const
473+ uint64_t getLastModified (const RepoInfo & repoInfo, const std::filesystem::path & repoDir, const Hash & rev) const
474474 {
475475 Cache::Key key{" gitLastModified" , {{" rev" , rev.gitRev ()}}};
476476
@@ -486,7 +486,7 @@ struct GitInputScheme : InputScheme
486486 return lastModified;
487487 }
488488
489- uint64_t getRevCount (const RepoInfo & repoInfo, const std::string & repoDir, const Hash & rev) const
489+ uint64_t getRevCount (const RepoInfo & repoInfo, const std::filesystem::path & repoDir, const Hash & rev) const
490490 {
491491 Cache::Key key{" gitRevCount" , {{" rev" , rev.gitRev ()}}};
492492
@@ -557,30 +557,30 @@ struct GitInputScheme : InputScheme
557557 auto ref = originalRef ? *originalRef : getDefaultRef (repoInfo);
558558 input.attrs .insert_or_assign (" ref" , ref);
559559
560- Path repoDir;
560+ std::filesystem::path repoDir;
561561
562562 if (auto repoPath = repoInfo.getPath ()) {
563563 repoDir = *repoPath;
564564 if (!input.getRev ())
565565 input.attrs .insert_or_assign (" rev" , GitRepo::openRepo (repoDir)->resolveRef (ref).gitRev ());
566566 } else {
567567 auto repoUrl = std::get<ParsedURL>(repoInfo.location );
568- Path cacheDir = getCachePath (repoUrl.to_string (), getShallowAttr (input));
568+ std::filesystem::path cacheDir = getCachePath (repoUrl.to_string (), getShallowAttr (input));
569569 repoDir = cacheDir;
570570 repoInfo.gitDir = " ." ;
571571
572- createDirs ( dirOf ( cacheDir));
573- PathLocks cacheDirLock ({cacheDir});
572+ std::filesystem::create_directories ( cacheDir. parent_path ( ));
573+ PathLocks cacheDirLock ({cacheDir. string () });
574574
575575 auto repo = GitRepo::openRepo (cacheDir, true , true );
576576
577577 // We need to set the origin so resolving submodule URLs works
578578 repo->setRemote (" origin" , repoUrl.to_string ());
579579
580- Path localRefFile =
580+ auto localRefFile =
581581 ref.compare (0 , 5 , " refs/" ) == 0
582- ? cacheDir + " / " + ref
583- : cacheDir + " / refs/heads/ " + ref;
582+ ? cacheDir / ref
583+ : cacheDir / " refs/heads" / ref;
584584
585585 bool doFetch;
586586 time_t now = time (0 );
@@ -596,7 +596,7 @@ struct GitInputScheme : InputScheme
596596 /* If the local ref is older than ‘tarball-ttl’ seconds, do a
597597 git fetch to update the local ref to the remote ref. */
598598 struct stat st;
599- doFetch = stat (localRefFile.c_str (), &st) != 0 ||
599+ doFetch = stat (localRefFile.string (). c_str (), &st) != 0 ||
600600 !isCacheFileWithinTtl (now, st);
601601 }
602602 }
@@ -616,7 +616,7 @@ struct GitInputScheme : InputScheme
616616
617617 repo->fetch (repoUrl.to_string (), fmt (" %s:%s" , fetchRef, fetchRef), getShallowAttr (input));
618618 } catch (Error & e) {
619- if (!pathExists (localRefFile)) throw ;
619+ if (!std::filesystem::exists (localRefFile)) throw ;
620620 logError (e.info ());
621621 warn (" could not update local clone of Git repository '%s'; continuing with the most recent version" , repoInfo.locationToArg ());
622622 }
@@ -850,7 +850,7 @@ struct GitInputScheme : InputScheme
850850 for (auto & file : repoInfo.workdirInfo .dirtyFiles ) {
851851 writeString (" modified:" , hashSink);
852852 writeString (file.abs (), hashSink);
853- dumpPath (*repoPath / file.rel (), hashSink);
853+ dumpPath (( *repoPath / file.rel ()). string (), hashSink);
854854 }
855855 for (auto & file : repoInfo.workdirInfo .deletedFiles ) {
856856 writeString (" deleted:" , hashSink);
0 commit comments