File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the swift-libgit2 open source project.
4+ //
5+ // Copyright (c) Margins Technologies LLC.
6+ // Licensed under the Apache License, Version 2.0.
7+ //
8+ //===----------------------------------------------------------------------===//
9+
10+ import CLibgit2
11+
12+
13+
14+ /// Creates a new direct reference using the given name and ID.
15+ /// - Parameters:
16+ /// - name: The reference name to use.
17+ /// - oid: The reference ID to use.
18+ /// - peel: The ID of the first non-tag object to use.
19+ /// - Returns: The new direct reference using the given name and ID.
20+ ///
21+ /// ## C Equivalent
22+ ///
23+ /// [`git_reference__alloc()`](https://libgit2.org/docs/reference/main/sys/refs/git_reference__alloc.html)
24+ public func gitReferenceAlloc(
25+ name : String ,
26+ oid : GitOID ,
27+ peel : GitOID ?
28+ ) -> OpaquePointer ?
29+ {
30+ return try ? oid. withCValue
31+ {
32+ cOID in
33+
34+ return try peel. withOptionalCValue
35+ {
36+ cPeel in
37+
38+ return git_reference__alloc (
39+ name,
40+ cOID,
41+ cPeel
42+ )
43+ }
44+ }
45+ }
46+
47+
48+
49+ /// Creates a new symbolic reference using the given name and target.
50+ /// - Parameters:
51+ /// - name: The reference name to use.
52+ /// - target: The reference target to use.
53+ /// - Returns: The new direct reference using the given name and target.
54+ ///
55+ /// ## C Equivalent
56+ ///
57+ /// [`git_reference__alloc_symbolic()`](https://libgit2.org/docs/reference/main/sys/refs/git_reference__alloc_symbolic.html)
58+ public func gitReferenceAllocSymbolic(
59+ name : String ,
60+ target : String
61+ ) -> OpaquePointer ?
62+ {
63+ return git_reference__alloc_symbolic (
64+ name,
65+ target
66+ )
67+ }
Original file line number Diff line number Diff line change 1+ # Refs (Advanced)
2+
3+ Low-level reference creation.
4+
5+ ## Topics
6+
7+ ### Functions
8+
9+ - `` gitReferenceAlloc(name:oid:peel:) ``
10+ - `` gitReferenceAllocSymbolic(name:target:) ``
You can’t perform that action at this time.
0 commit comments