|
||||
File indexing completed on 2025-01-18 09:59:37
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_git_graph_h__ 0008 #define INCLUDE_git_graph_h__ 0009 0010 #include "common.h" 0011 #include "types.h" 0012 #include "oid.h" 0013 0014 /** 0015 * @file git2/graph.h 0016 * @brief Git graph traversal routines 0017 * @defgroup git_revwalk Git graph traversal routines 0018 * @ingroup Git 0019 * @{ 0020 */ 0021 GIT_BEGIN_DECL 0022 0023 /** 0024 * Count the number of unique commits between two commit objects 0025 * 0026 * There is no need for branches containing the commits to have any 0027 * upstream relationship, but it helps to think of one as a branch and 0028 * the other as its upstream, the `ahead` and `behind` values will be 0029 * what git would report for the branches. 0030 * 0031 * @param ahead number of unique from commits in `upstream` 0032 * @param behind number of unique from commits in `local` 0033 * @param repo the repository where the commits exist 0034 * @param local the commit for local 0035 * @param upstream the commit for upstream 0036 * @return 0 or an error code. 0037 */ 0038 GIT_EXTERN(int) git_graph_ahead_behind(size_t *ahead, size_t *behind, git_repository *repo, const git_oid *local, const git_oid *upstream); 0039 0040 0041 /** 0042 * Determine if a commit is the descendant of another commit. 0043 * 0044 * Note that a commit is not considered a descendant of itself, in contrast 0045 * to `git merge-base --is-ancestor`. 0046 * 0047 * @param repo the repository where the commits exist 0048 * @param commit a previously loaded commit 0049 * @param ancestor a potential ancestor commit 0050 * @return 1 if the given commit is a descendant of the potential ancestor, 0051 * 0 if not, error code otherwise. 0052 */ 0053 GIT_EXTERN(int) git_graph_descendant_of( 0054 git_repository *repo, 0055 const git_oid *commit, 0056 const git_oid *ancestor); 0057 0058 /** 0059 * Determine if a commit is reachable from any of a list of commits by 0060 * following parent edges. 0061 * 0062 * @param repo the repository where the commits exist 0063 * @param commit a previously loaded commit 0064 * @param length the number of commits in the provided `descendant_array` 0065 * @param descendant_array oids of the commits 0066 * @return 1 if the given commit is an ancestor of any of the given potential 0067 * descendants, 0 if not, error code otherwise. 0068 */ 0069 GIT_EXTERN(int) git_graph_reachable_from_any( 0070 git_repository *repo, 0071 const git_oid *commit, 0072 const git_oid descendant_array[], 0073 size_t length); 0074 0075 /** @} */ 0076 GIT_END_DECL 0077 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |