Blame


1 5261c201 2018-04-01 stsp /*
2 5261c201 2018-04-01 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 5261c201 2018-04-01 stsp *
4 5261c201 2018-04-01 stsp * Permission to use, copy, modify, and distribute this software for any
5 5261c201 2018-04-01 stsp * purpose with or without fee is hereby granted, provided that the above
6 5261c201 2018-04-01 stsp * copyright notice and this permission notice appear in all copies.
7 5261c201 2018-04-01 stsp *
8 5261c201 2018-04-01 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 5261c201 2018-04-01 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 5261c201 2018-04-01 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 5261c201 2018-04-01 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 5261c201 2018-04-01 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 5261c201 2018-04-01 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 5261c201 2018-04-01 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 5261c201 2018-04-01 stsp */
16 5261c201 2018-04-01 stsp
17 5261c201 2018-04-01 stsp /* A reference which points to an arbitrary object. */
18 5261c201 2018-04-01 stsp struct got_reference;
19 5261c201 2018-04-01 stsp
20 5261c201 2018-04-01 stsp /* Well-known reference names. */
21 5261c201 2018-04-01 stsp #define GOT_REF_HEAD "HEAD"
22 5261c201 2018-04-01 stsp #define GOT_REF_ORIG_HEAD "ORIG_HEAD"
23 5261c201 2018-04-01 stsp #define GOT_REF_MERGE_HEAD "MERGE_HEAD"
24 5261c201 2018-04-01 stsp #define GOT_REF_FETCH_HEAD "FETCH_HEAD"
25 5261c201 2018-04-01 stsp
26 5261c201 2018-04-01 stsp struct got_repository;
27 5261c201 2018-04-01 stsp struct got_object_id;
28 5261c201 2018-04-01 stsp
29 0c60ce5a 2018-04-02 stsp /*
30 0c60ce5a 2018-04-02 stsp * Attempt to open the reference with the provided name in a repository.
31 0c60ce5a 2018-04-02 stsp * The caller must dispose of it with got_ref_close().
32 0c60ce5a 2018-04-02 stsp */
33 5261c201 2018-04-01 stsp const struct got_error * got_ref_open(struct got_reference **,
34 5261c201 2018-04-01 stsp struct got_repository *, const char *);
35 0c60ce5a 2018-04-02 stsp
36 0c60ce5a 2018-04-02 stsp /* Dispose of a reference. */
37 5261c201 2018-04-01 stsp void got_ref_close(struct got_reference *);
38 0c60ce5a 2018-04-02 stsp
39 0c60ce5a 2018-04-02 stsp /*
40 0c60ce5a 2018-04-02 stsp * Create a duplicate copy of a reference.
41 0c60ce5a 2018-04-02 stsp * The caller must dispose of this copy with got_ref_close().
42 0c60ce5a 2018-04-02 stsp */
43 5261c201 2018-04-01 stsp struct got_reference *got_ref_dup(struct got_reference *);
44 0c60ce5a 2018-04-02 stsp
45 0c60ce5a 2018-04-02 stsp /* Attempt to resolve a reference to an object ID. */
46 5261c201 2018-04-01 stsp const struct got_error *got_ref_resolve(struct got_object_id **,
47 5261c201 2018-04-01 stsp struct got_repository *, struct got_reference *);
48 0c60ce5a 2018-04-02 stsp
49 0c60ce5a 2018-04-02 stsp /* Return a string representation of a reference. */
50 5261c201 2018-04-01 stsp char *got_ref_to_str(struct got_reference *);