Symlink does not consider if a file has been modified
See original GitHub issueThis is one of those edge cases nobody likes to think about.
A few things I’ve noticed with symlinks:
- If the file.basename is renamed before being piped into
symlink
, it will generate broken links. - If the file.contents is modified, a symlink is still generated (an error would be preferred).
Admittedly, I’m still using v2.4.4, but I don’t see anything in master to suggest this has been fixed.
In my use case, I’m wrapping gulp to play nicely with a PHP framework. I’ve had to override dest
to auto rename files and to log written filenames. One of the problems I’m trying to overcome is that if file contents have not been modified, they must be linked rather than copied. As it stands I have no way to detect this without also overriding src
and possibly hashing the contents.
A great solution would be to add a revision
property to the file object. This would start out at 0 and be increased any time the content is modified. This will also help solve problem (2) above.
In the mean time, can anybody suggest an ideal workaround for detecting changed contents?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top GitHub Comments
I think – but would need a bit more time to figure out for sure – that it might be tricky in multi-stage pipelines like this:
Pretty contrived though, I admit 😃
@phated what’s your recommended way to set a different name for the symlink then, keeping the same target?