|
||||
File indexing completed on 2025-01-18 09:59:36
0001 /* 0002 * Copyright (C) the libgit2 contributors. All rights reserved. 0003 * 0004 * This file is part of libgit2, distributed under the GNU GPL v2 with 0005 * a Linking Exception. For full terms see the included COPYING file. 0006 */ 0007 #ifndef INCLUDE_sys_git_diff_h__ 0008 #define INCLUDE_sys_git_diff_h__ 0009 0010 #include "git2/common.h" 0011 #include "git2/types.h" 0012 #include "git2/oid.h" 0013 #include "git2/diff.h" 0014 #include "git2/status.h" 0015 0016 /** 0017 * @file git2/sys/diff.h 0018 * @brief Low-level Git diff utilities 0019 * @ingroup Git 0020 * @{ 0021 */ 0022 GIT_BEGIN_DECL 0023 0024 /** 0025 * Diff print callback that writes to a git_buf. 0026 * 0027 * This function is provided not for you to call it directly, but instead 0028 * so you can use it as a function pointer to the `git_diff_print` or 0029 * `git_patch_print` APIs. When using those APIs, you specify a callback 0030 * to actually handle the diff and/or patch data. 0031 * 0032 * Use this callback to easily write that data to a `git_buf` buffer. You 0033 * must pass a `git_buf *` value as the payload to the `git_diff_print` 0034 * and/or `git_patch_print` function. The data will be appended to the 0035 * buffer (after any existing content). 0036 */ 0037 GIT_EXTERN(int) git_diff_print_callback__to_buf( 0038 const git_diff_delta *delta, 0039 const git_diff_hunk *hunk, 0040 const git_diff_line *line, 0041 void *payload); /**< payload must be a `git_buf *` */ 0042 0043 /** 0044 * Diff print callback that writes to stdio FILE handle. 0045 * 0046 * This function is provided not for you to call it directly, but instead 0047 * so you can use it as a function pointer to the `git_diff_print` or 0048 * `git_patch_print` APIs. When using those APIs, you specify a callback 0049 * to actually handle the diff and/or patch data. 0050 * 0051 * Use this callback to easily write that data to a stdio FILE handle. You 0052 * must pass a `FILE *` value (such as `stdout` or `stderr` or the return 0053 * value from `fopen()`) as the payload to the `git_diff_print` 0054 * and/or `git_patch_print` function. If you pass NULL, this will write 0055 * data to `stdout`. 0056 */ 0057 GIT_EXTERN(int) git_diff_print_callback__to_file_handle( 0058 const git_diff_delta *delta, 0059 const git_diff_hunk *hunk, 0060 const git_diff_line *line, 0061 void *payload); /**< payload must be a `FILE *` */ 0062 0063 0064 /** 0065 * Performance data from diffing 0066 */ 0067 typedef struct { 0068 unsigned int version; 0069 size_t stat_calls; /**< Number of stat() calls performed */ 0070 size_t oid_calculations; /**< Number of ID calculations */ 0071 } git_diff_perfdata; 0072 0073 #define GIT_DIFF_PERFDATA_VERSION 1 0074 #define GIT_DIFF_PERFDATA_INIT {GIT_DIFF_PERFDATA_VERSION,0,0} 0075 0076 /** 0077 * Get performance data for a diff object. 0078 * 0079 * @param out Structure to be filled with diff performance data 0080 * @param diff Diff to read performance data from 0081 * @return 0 for success, <0 for error 0082 */ 0083 GIT_EXTERN(int) git_diff_get_perfdata( 0084 git_diff_perfdata *out, const git_diff *diff); 0085 0086 /** 0087 * Get performance data for diffs from a git_status_list 0088 */ 0089 GIT_EXTERN(int) git_status_list_get_perfdata( 0090 git_diff_perfdata *out, const git_status_list *status); 0091 0092 /** @} */ 0093 GIT_END_DECL 0094 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |