1
- use crate :: bstr:: { BStr , BString } ;
2
-
3
1
/// If `Yes`, don't really make changes but do as much as possible to get an idea of what would be done.
4
2
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
5
3
#[ cfg( any( feature = "blocking-network-client" , feature = "async-network-client" ) ) ]
@@ -20,8 +18,28 @@ pub(crate) enum WritePackedRefs {
20
18
Only ,
21
19
}
22
20
21
+ /// Describe how to handle tags when fetching
22
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
23
+ pub enum Tags {
24
+ /// Fetch all tags from the remote, even if these are not reachable from objects referred to by our refspecs.
25
+ All ,
26
+ /// Fetch only the tags that point to the objects being sent.
27
+ /// That way, annotated tags that point to an object we receive are automatically transmitted and their refs are created.
28
+ /// The same goes for lightweight tags.
29
+ Included ,
30
+ /// Do not fetch any tags.
31
+ None ,
32
+ }
33
+
34
+ impl Default for Tags {
35
+ fn default ( ) -> Self {
36
+ Tags :: Included
37
+ }
38
+ }
39
+
23
40
/// Information about the relationship between our refspecs, and remote references with their local counterparts.
24
41
#[ derive( Default , Debug , Clone ) ]
42
+ #[ cfg( any( feature = "blocking-network-client" , feature = "async-network-client" ) ) ]
25
43
pub struct RefMap {
26
44
/// A mapping between a remote reference and a local tracking branch.
27
45
pub mappings : Vec < Mapping > ,
@@ -41,13 +59,15 @@ pub struct RefMap {
41
59
42
60
/// Either an object id that the remote has or the matched remote ref itself.
43
61
#[ derive( Debug , Clone ) ]
62
+ #[ cfg( any( feature = "blocking-network-client" , feature = "async-network-client" ) ) ]
44
63
pub enum Source {
45
64
/// An object id, as the matched ref-spec was an object id itself.
46
65
ObjectId ( git_hash:: ObjectId ) ,
47
66
/// The remote reference that matched the ref-specs name.
48
67
Ref ( git_protocol:: handshake:: Ref ) ,
49
68
}
50
69
70
+ #[ cfg( any( feature = "blocking-network-client" , feature = "async-network-client" ) ) ]
51
71
impl Source {
52
72
/// Return either the direct object id we refer to or the direct target that a reference refers to.
53
73
/// The latter may be a direct or a symbolic reference, and we degenerate this to the peeled object id.
@@ -60,7 +80,7 @@ impl Source {
60
80
}
61
81
62
82
/// Return ourselves as the full name of the reference we represent, or `None` if this source isn't a reference but an object.
63
- pub fn as_name ( & self ) -> Option < & BStr > {
83
+ pub fn as_name ( & self ) -> Option < & crate :: bstr :: BStr > {
64
84
match self {
65
85
Source :: ObjectId ( _) => None ,
66
86
Source :: Ref ( r) => match r {
@@ -75,11 +95,12 @@ impl Source {
75
95
76
96
/// A mapping between a single remote reference and its advertised objects to a local destination which may or may not exist.
77
97
#[ derive( Debug , Clone ) ]
98
+ #[ cfg( any( feature = "blocking-network-client" , feature = "async-network-client" ) ) ]
78
99
pub struct Mapping {
79
100
/// The reference on the remote side, along with information about the objects they point to as advertised by the server.
80
101
pub remote : Source ,
81
102
/// The local tracking reference to update after fetching the object visible via `remote`.
82
- pub local : Option < BString > ,
103
+ pub local : Option < crate :: bstr :: BString > ,
83
104
/// The index into the fetch ref-specs used to produce the mapping, allowing it to be recovered.
84
105
pub spec_index : usize ,
85
106
}
0 commit comments