Calculate hash of file using repository filtering rules.
If you simply want to calculate the hash of a file on disk with no filters,
you can just use the git_odb_hashfile()
API. However, if you want to
hash a file in the repository and you want to apply filtering rules (e.g.
crlf filters) before generating the SHA, then use this function.
Note: if the repository has core.safecrlf
set to fail and the
filtering triggers that failure, then this function will return an
error and not calculate the hash of the file.
Path to file on disk whose contents should be hashed. This may be an absolute path or a relative path, in which case it will be treated as a path within the working directory.
The path to use to look up filtering rules. If this is an empty string then no filters will be applied when calculating the hash. If this is NULL
and the path
parameter is a file within the repository's working directory, then the path
will be used.
0 on success, or an error code