refspec: s/refspec_item_init/&_or_die/g
[git/git.git] / refspec.h
CommitLineData
ec0cb496
BW
1#ifndef REFSPEC_H
2#define REFSPEC_H
3
4#define TAG_REFSPEC "refs/tags/*:refs/tags/*"
0ad4a5ff 5extern const struct refspec_item *tag_refspec;
ec0cb496 6
0ad4a5ff 7struct refspec_item {
ec0cb496
BW
8 unsigned force : 1;
9 unsigned pattern : 1;
10 unsigned matching : 1;
11 unsigned exact_sha1 : 1;
12
13 char *src;
14 char *dst;
15};
16
6d4c0578
BW
17#define REFSPEC_FETCH 1
18#define REFSPEC_PUSH 0
19
20#define REFSPEC_INIT_FETCH { .fetch = REFSPEC_FETCH }
21#define REFSPEC_INIT_PUSH { .fetch = REFSPEC_PUSH }
22
23struct refspec {
24 struct refspec_item *items;
25 int alloc;
26 int nr;
27
28 const char **raw;
29 int raw_alloc;
30 int raw_nr;
31
32 int fetch;
33};
34
dc064221
ÆAB
35void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
36 int fetch);
6d4c0578
BW
37void refspec_item_clear(struct refspec_item *item);
38void refspec_init(struct refspec *rs, int fetch);
39void refspec_append(struct refspec *rs, const char *refspec);
40void refspec_appendn(struct refspec *rs, const char **refspecs, int nr);
41void refspec_clear(struct refspec *rs);
42
c8fa9efe
BW
43int valid_fetch_refspec(const char *refspec);
44
6373cb59 45struct argv_array;
6c301adb
JN
46/*
47 * Determine what <prefix> values to pass to the peer in ref-prefix lines
48 * (see Documentation/technical/protocol-v2.txt).
49 */
6373cb59
BW
50void refspec_ref_prefixes(const struct refspec *rs,
51 struct argv_array *ref_prefixes);
52
ec0cb496 53#endif /* REFSPEC_H */