• Junio C Hamano's avatar
    csum-file: introduce sha1file_checkpoint · 6c526148
    Junio C Hamano authored
    It is useful to be able to rewind a check-summed file to a certain
    previous state after writing data into it using sha1write() API. The
    fast-import command does this after streaming a blob data to the packfile
    being generated and then noticing that the same blob has already been
    written, and it does this with a private code truncate_pack() that is
    commented as "Yes, this is a layering violation".
    
    Introduce two API functions, sha1file_checkpoint(), that allows the caller
    to save a state of a sha1file, and then later revert it to the saved state.
    Use it to reimplement truncate_pack().
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    6c526148
csum-file.h 1.05 KB