svn_fs_file_checksum

Function svn_fs_file_checksum 

Source
pub unsafe extern "C" fn svn_fs_file_checksum(
    checksum: *mut *mut svn_checksum_t,
    kind: svn_checksum_kind_t,
    root: *mut svn_fs_root_t,
    path: *const c_char,
    force: svn_boolean_t,
    pool: *mut apr_pool_t,
) -> *mut svn_error_t
Expand description

Set @a *checksum to the checksum of type @a kind for the file @a path. @a *checksum will be allocated out of @a pool, which will also be used for temporary allocations.

If the filesystem does not have a prerecorded checksum of @a kind for @a path, and @a force is not TRUE, do not calculate a checksum dynamically, just put NULL into @a checksum. (By convention, the NULL checksum is considered to match any checksum.)

Notes:

You might wonder, why do we only provide this interface for file contents, and not for properties or directories?

The answer is that property lists and directory entry lists are essentially data structures, not text. We serialize them for transmission, but there is no guarantee that the consumer will parse them into the same form, or even the same order, as the producer. It’s difficult to find a checksumming method that reaches the same result given such variation in input. (I suppose we could calculate an independent MD5 sum for each propname and value, and XOR them together; same with directory entry names. Maybe that’s the solution?) Anyway, for now we punt. The most important data, and the only data that goes through svndiff processing, is file contents, so that’s what we provide checksumming for.

Internally, of course, the filesystem checksums everything, because it has access to the lowest level storage forms: strings behind representations.

@since New in 1.6.