For Git, you could embed a string of the form:
<git commit id>:path/in/repo/to/file.ext
to be able to retrieve the exact source file contents used to build something.