mirror of
https://github.com/NixOS/nix.git
synced 2025-11-12 13:36:02 +01:00
refactor(libstore/find-cycles): rename scanForCycleEdges2 → walkAndScanPath
The "2" suffix was unclear and didn't communicate the function's purpose. The new name better describes what it does: walks the filesystem tree and scans each file using the provided sink.
This commit is contained in:
parent
c70df0a2da
commit
d381d24fe3
2 changed files with 8 additions and 8 deletions
|
|
@ -69,7 +69,7 @@ void scanForCycleEdges(const Path & path, const StorePathSet & refs, StoreCycleE
|
|||
CycleEdgeScanSink sink(std::move(hashes), storePrefix);
|
||||
|
||||
// Walk the filesystem and scan files using the sink
|
||||
scanForCycleEdges2(path, sink);
|
||||
walkAndScanPath(path, sink);
|
||||
|
||||
// Extract the found edges
|
||||
edges = sink.getEdges();
|
||||
|
|
@ -79,12 +79,12 @@ void scanForCycleEdges(const Path & path, const StorePathSet & refs, StoreCycleE
|
|||
* Recursively walk filesystem and stream files into the sink.
|
||||
* This reuses RefScanSink's hash-finding logic instead of reimplementing it.
|
||||
*/
|
||||
void scanForCycleEdges2(const std::string & path, CycleEdgeScanSink & sink)
|
||||
void walkAndScanPath(const std::string & path, CycleEdgeScanSink & sink)
|
||||
{
|
||||
auto fsPath = std::filesystem::path(path);
|
||||
auto status = std::filesystem::symlink_status(fsPath);
|
||||
|
||||
debug("scanForCycleEdges2: scanning path = %s", path);
|
||||
debug("walkAndScanPath: scanning path = %s", path);
|
||||
|
||||
if (std::filesystem::is_regular_file(status)) {
|
||||
// Handle regular files - stream contents into sink
|
||||
|
|
@ -122,14 +122,14 @@ void scanForCycleEdges2(const std::string & path, CycleEdgeScanSink & sink)
|
|||
}
|
||||
|
||||
for (auto & [name, actualName] : unhacked) {
|
||||
debug("scanForCycleEdges2: recursing into %s/%s", path, actualName);
|
||||
scanForCycleEdges2((fsPath / actualName).string(), sink);
|
||||
debug("walkAndScanPath: recursing into %s/%s", path, actualName);
|
||||
walkAndScanPath((fsPath / actualName).string(), sink);
|
||||
}
|
||||
} else if (std::filesystem::is_symlink(status)) {
|
||||
// Handle symlinks - stream link target into sink
|
||||
auto linkTarget = std::filesystem::read_symlink(fsPath).string();
|
||||
|
||||
debug("scanForCycleEdges2: scanning symlink %s -> %s", path, linkTarget);
|
||||
debug("walkAndScanPath: scanning symlink %s -> %s", path, linkTarget);
|
||||
|
||||
sink.setCurrentPath(path);
|
||||
sink(std::string_view(linkTarget));
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public:
|
|||
void scanForCycleEdges(const Path & path, const StorePathSet & refs, StoreCycleEdgeVec & edges);
|
||||
|
||||
/**
|
||||
* Recursively scan files and directories for hash references.
|
||||
* Recursively walk filesystem tree and scan each file for hash references.
|
||||
*
|
||||
* This function walks the file system tree, streaming file contents into
|
||||
* the provided sink which performs the actual hash detection. This reuses
|
||||
|
|
@ -86,7 +86,7 @@ void scanForCycleEdges(const Path & path, const StorePathSet & refs, StoreCycleE
|
|||
* @param path Current path being scanned
|
||||
* @param sink The CycleEdgeScanSink that will detect and record hash references
|
||||
*/
|
||||
void scanForCycleEdges2(const std::string & path, CycleEdgeScanSink & sink);
|
||||
void walkAndScanPath(const std::string & path, CycleEdgeScanSink & sink);
|
||||
|
||||
/**
|
||||
* Transform individual edges into connected multi-edges (paths).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue