|
||||
File indexing completed on 2025-01-18 09:59:38
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_revparse_h__ 0008 #define INCLUDE_git_revparse_h__ 0009 0010 #include "common.h" 0011 #include "types.h" 0012 0013 /** 0014 * @file git2/revparse.h 0015 * @brief Git revision parsing routines 0016 * @defgroup git_revparse Git revision parsing routines 0017 * @ingroup Git 0018 * @{ 0019 */ 0020 GIT_BEGIN_DECL 0021 0022 /** 0023 * Find a single object, as specified by a revision string. 0024 * 0025 * See `man gitrevisions`, or 0026 * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for 0027 * information on the syntax accepted. 0028 * 0029 * The returned object should be released with `git_object_free` when no 0030 * longer needed. 0031 * 0032 * @param out pointer to output object 0033 * @param repo the repository to search in 0034 * @param spec the textual specification for an object 0035 * @return 0 on success, GIT_ENOTFOUND, GIT_EAMBIGUOUS, GIT_EINVALIDSPEC or an error code 0036 */ 0037 GIT_EXTERN(int) git_revparse_single( 0038 git_object **out, git_repository *repo, const char *spec); 0039 0040 /** 0041 * Find a single object and intermediate reference by a revision string. 0042 * 0043 * See `man gitrevisions`, or 0044 * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for 0045 * information on the syntax accepted. 0046 * 0047 * In some cases (`@{<-n>}` or `<branchname>@{upstream}`), the expression may 0048 * point to an intermediate reference. When such expressions are being passed 0049 * in, `reference_out` will be valued as well. 0050 * 0051 * The returned object should be released with `git_object_free` and the 0052 * returned reference with `git_reference_free` when no longer needed. 0053 * 0054 * @param object_out pointer to output object 0055 * @param reference_out pointer to output reference or NULL 0056 * @param repo the repository to search in 0057 * @param spec the textual specification for an object 0058 * @return 0 on success, GIT_ENOTFOUND, GIT_EAMBIGUOUS, GIT_EINVALIDSPEC 0059 * or an error code 0060 */ 0061 GIT_EXTERN(int) git_revparse_ext( 0062 git_object **object_out, 0063 git_reference **reference_out, 0064 git_repository *repo, 0065 const char *spec); 0066 0067 /** 0068 * Revparse flags. These indicate the intended behavior of the spec passed to 0069 * git_revparse. 0070 */ 0071 typedef enum { 0072 /** The spec targeted a single object. */ 0073 GIT_REVSPEC_SINGLE = 1 << 0, 0074 /** The spec targeted a range of commits. */ 0075 GIT_REVSPEC_RANGE = 1 << 1, 0076 /** The spec used the '...' operator, which invokes special semantics. */ 0077 GIT_REVSPEC_MERGE_BASE = 1 << 2 0078 } git_revspec_t; 0079 0080 /** 0081 * Git Revision Spec: output of a `git_revparse` operation 0082 */ 0083 typedef struct { 0084 /** The left element of the revspec; must be freed by the user */ 0085 git_object *from; 0086 /** The right element of the revspec; must be freed by the user */ 0087 git_object *to; 0088 /** The intent of the revspec (i.e. `git_revspec_mode_t` flags) */ 0089 unsigned int flags; 0090 } git_revspec; 0091 0092 /** 0093 * Parse a revision string for `from`, `to`, and intent. 0094 * 0095 * See `man gitrevisions` or 0096 * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for 0097 * information on the syntax accepted. 0098 * 0099 * @param revspec Pointer to an user-allocated git_revspec struct where 0100 * the result of the rev-parse will be stored 0101 * @param repo the repository to search in 0102 * @param spec the rev-parse spec to parse 0103 * @return 0 on success, GIT_INVALIDSPEC, GIT_ENOTFOUND, GIT_EAMBIGUOUS or an error code 0104 */ 0105 GIT_EXTERN(int) git_revparse( 0106 git_revspec *revspec, 0107 git_repository *repo, 0108 const char *spec); 0109 0110 0111 /** @} */ 0112 GIT_END_DECL 0113 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |