fix(fingerprint): Add $global Parameter to Fingerprint Functions and Path Handling Fixes #527
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
$global
Parameter to Fingerprint Functions and Path Handling FixesSummary
Close #511
Added: A
$global
parameter to fingerprint functions, allowing the option to use a global scope for fingerprint. By default, fingerprints are scoped by the project based on the directory path. Setting$global
totrue
enables global fingerprinting, independent of the project path.Fixed: Path handling issues for file operations such as
hasher()->writeFile('../test.txt')->finish();
. Previously, the relative path could cause incorrect fingerprint generation due to differences in project directories. Now, the path is normalized usingrealpath()
to ensure consistency.Changes
Global Scope for Fingerprints:
$global
parameter to fingerprint functions, allowing for optional global scoping of fingerprints.$global = true
will ensure fingerprints are globally consistent across different projects.Path Resolution Fix in
writeFile(...)
:Previously, if you ran the following code in two different project directories:
/home/projects/project-a
, the file would resolve as/home/projects/project-a/../test.txt
./home/projects/project-b
, the file would resolve as/home/projects/project-b/../test.txt
.Fix: With the addition of
realpath()
inwriteFile(...)
, the path is now resolved to an absolute path:/home/projects/test.txt
in both cases.Path Resolution in
writeGlob(...)
andwriteFinder(...)
:realpath()
is used inwriteGlob(...)
, and->getRealPath()
is applied inwriteFinder(...)
to ensure correct absolute path resolution across different project contexts.