1 /* 2 * Copyright (C) the libgit2 contributors. All rights reserved. 3 * 4 * This file is part of libgit2, distributed under the GNU GPL v2 with 5 * a Linking Exception. For full terms see the included COPYING file. 6 */ 7 module libgit2_d.refspec; 8 9 10 private static import libgit2_d.buffer; 11 private static import libgit2_d.net; 12 private static import libgit2_d.types; 13 14 /** 15 * @file git2/refspec.h 16 * @brief Git refspec attributes 17 * @defgroup git_refspec Git refspec attributes 18 * @ingroup Git 19 * @{ 20 */ 21 extern (C): 22 nothrow @nogc: 23 public: 24 25 /** 26 * Parse a given refspec string 27 * 28 * @param refspec a pointer to hold the refspec handle 29 * @param input the refspec string 30 * @param is_fetch is this a refspec for a fetch 31 * @return 0 if the refspec string could be parsed, -1 otherwise 32 */ 33 //GIT_EXTERN 34 int git_refspec_parse(libgit2_d.types.git_refspec** refspec, const (char)* input, int is_fetch); 35 36 /** 37 * Free a refspec object which has been created by git_refspec_parse 38 * 39 * @param refspec the refspec object 40 */ 41 //GIT_EXTERN 42 void git_refspec_free(libgit2_d.types.git_refspec* refspec); 43 44 /** 45 * Get the source specifier 46 * 47 * @param refspec the refspec 48 * @return the refspec's source specifier 49 */ 50 //GIT_EXTERN 51 const (char)* git_refspec_src(const (libgit2_d.types.git_refspec)* refspec); 52 53 /** 54 * Get the destination specifier 55 * 56 * @param refspec the refspec 57 * @return the refspec's destination specifier 58 */ 59 //GIT_EXTERN 60 const (char)* git_refspec_dst(const (libgit2_d.types.git_refspec)* refspec); 61 62 /** 63 * Get the refspec's string 64 * 65 * @param refspec the refspec 66 * @returns the refspec's original string 67 */ 68 //GIT_EXTERN 69 const (char)* git_refspec_string(const (libgit2_d.types.git_refspec)* refspec); 70 71 /** 72 * Get the force update setting 73 * 74 * @param refspec the refspec 75 * @return 1 if force update has been set, 0 otherwise 76 */ 77 //GIT_EXTERN 78 int git_refspec_force(const (libgit2_d.types.git_refspec)* refspec); 79 80 /** 81 * Get the refspec's direction. 82 * 83 * @param spec refspec 84 * @return git_direction.GIT_DIRECTION_FETCH or git_direction.GIT_DIRECTION_PUSH 85 */ 86 //GIT_EXTERN 87 libgit2_d.net.git_direction git_refspec_direction(const (libgit2_d.types.git_refspec)* spec); 88 89 /** 90 * Check if a refspec's source descriptor matches a reference 91 * 92 * @param refspec the refspec 93 * @param refname the name of the reference to check 94 * @return 1 if the refspec matches, 0 otherwise 95 */ 96 //GIT_EXTERN 97 int git_refspec_src_matches(const (libgit2_d.types.git_refspec)* refspec, const (char)* refname); 98 99 /** 100 * Check if a refspec's destination descriptor matches a reference 101 * 102 * @param refspec the refspec 103 * @param refname the name of the reference to check 104 * @return 1 if the refspec matches, 0 otherwise 105 */ 106 //GIT_EXTERN 107 int git_refspec_dst_matches(const (libgit2_d.types.git_refspec)* refspec, const (char)* refname); 108 109 /** 110 * Transform a reference to its target following the refspec's rules 111 * 112 * @param out_ where to store the target name 113 * @param spec the refspec 114 * @param name the name of the reference to transform 115 * @return 0, git_error_code.GIT_EBUFS or another error 116 */ 117 //GIT_EXTERN 118 int git_refspec_transform(libgit2_d.buffer.git_buf* out_, const (libgit2_d.types.git_refspec)* spec, const (char)* name); 119 120 /** 121 * Transform a target reference to its source reference following the refspec's 122 * rules 123 * 124 * @param out_ where to store the source reference name 125 * @param spec the refspec 126 * @param name the name of the reference to transform 127 * @return 0, git_error_code.GIT_EBUFS or another error 128 */ 129 //GIT_EXTERN 130 int git_refspec_rtransform(libgit2_d.buffer.git_buf* out_, const (libgit2_d.types.git_refspec)* spec, const (char)* name);