diff options
| author | Vicent Martà <vicent@github.com> | 2012-09-13 09:24:12 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-09-13 09:24:12 -0700 |
| commit | 9be2261eaae74552aaa9d568e663292f4382e141 (patch) | |
| tree | fe9711595f4fe21e86989efcbd374ddb7bb5d157 /include/git2 | |
| parent | 45c4697c48e50951a383f93d63ad0c192915df8c (diff) | |
| parent | a13fb55afdbf9d74c3d4b6aa76476a005da49486 (diff) | |
| download | libgit2-9be2261eaae74552aaa9d568e663292f4382e141.tar.gz | |
Merge pull request #927 from arrbee/hashfile-with-filters
Add git_repository_hashfile to hash with filters
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/repository.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h index f520d5433..32ec58dae 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -481,6 +481,30 @@ GIT_EXTERN(int) git_repository_message(char *buffer, size_t len, git_repository */ GIT_EXTERN(int) git_repository_message_remove(git_repository *repo); +/** + * 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. + * + * @param out Output value of calculated SHA + * @param repo Repository pointer + * @param path Path to file on disk whose contents should be hashed. If the + * repository is not NULL, this can be a relative path. + * @param type The object type to hash as (e.g. GIT_OBJ_BLOB) + * @param as_path The path to use to look up filtering rules. If this is + * NULL, then the `path` parameter will be used instead. If + * this is passed as the empty string, then no filters will be + * applied when calculating the hash. + */ +GIT_EXTERN(int) git_repository_hashfile( + git_oid *out, + git_repository *repo, + const char *path, + git_otype type, + const char *as_path); /** @} */ GIT_END_DECL |
