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