Edit

thodg/got/include/got_diff.h

Branch :

  • Show log

    Commit

  • Author : Stefan Sperling
    Date : 2018-05-19 16:28:32
    Hash : 11528a82
    Message : move common diff helpers from got and tog into lib/diff.c

  • include/got_diff.h
  • /*
     * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
     *
     * Permission to use, copy, modify, and distribute this software for any
     * purpose with or without fee is hereby granted, provided that the above
     * copyright notice and this permission notice appear in all copies.
     *
     * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     */
    
    /*
     * Compute the differences between two blobs and write unified diff text
     * to the provided output FILE. Two const char * diff header labels may
     * be provided which will be used to identify each blob in the diff output.
     * If a label is NULL, use the blob's SHA1 checksum instead.
     */
    const struct got_error *got_diff_blob(struct got_blob_object *,
        struct got_blob_object *, const char *, const char *, FILE *);
    
    /*
     * Compute the differences between two trees and write unified diff text
     * to the provided output FILE.
     */
    const struct got_error *got_diff_tree(struct got_tree_object *,
        struct got_tree_object *, struct got_repository *, FILE *);
    
    /*
     * Diff two objects, assuming both objects are blobs.
     * Write unified diff text to the provided output FILE.
     */
    const struct got_error *got_diff_objects_as_blobs(struct got_object *,
        struct got_object *, struct got_repository *, FILE *);
    
    /*
     * Diff two objects, assuming both objects are trees.
     * Write unified diff text to the provided output FILE.
     */
    const struct got_error *got_diff_objects_as_trees(struct got_object *,
        struct got_object *, struct got_repository *, FILE *);
    
    /*
     * Diff two objects, assuming both objects are commits.
     * Write unified diff text to the provided output FILE.
     */
    const struct got_error *got_diff_objects_as_commits(struct got_object *,
        struct got_object *, struct got_repository *, FILE *);