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 #ifndef INCLUDE_refspec_h__ 8 #define INCLUDE_refspec_h__ 9 10 #include "common.h" 11 12 #include "git2/refspec.h" 13 #include "buffer.h" 14 #include "vector.h" 15 16 struct git_refspec { 17 char *string; 18 char *src; 19 char *dst; 20 unsigned int force :1, 21 push : 1, 22 pattern :1, 23 matching :1; 24 }; 25 26 #define GIT_REFSPEC_TAGS "refs/tags/*:refs/tags/*" 27 28 int git_refspec__parse( 29 struct git_refspec *refspec, 30 const char *str, 31 bool is_fetch); 32 33 void git_refspec__dispose(git_refspec *refspec); 34 35 int git_refspec__serialize(git_buf *out, const git_refspec *refspec); 36 37 /** 38 * Determines if a refspec is a wildcard refspec. 39 * 40 * @param spec the refspec 41 * @return 1 if the refspec is a wildcard, 0 otherwise 42 */ 43 int git_refspec_is_wildcard(const git_refspec *spec); 44 45 /** 46 * DWIM `spec` with `refs` existing on the remote, append the dwim'ed 47 * result in `out`. 48 */ 49 int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs); 50 51 #endif 52