File tree 3 files changed +19
-4
lines changed
3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,12 @@ pub enum Ref {
77
77
/// The hash of the object the `target` ref points to.
78
78
object : git_hash:: ObjectId ,
79
79
} ,
80
- /// `HEAD` is unborn on the remote and just points to the initial, unborn branch.
80
+ /// A ref is unborn on the remote and just points to the initial, unborn branch, as is the case in a newly initialized repository
81
+ /// or dangling symbolic refs.
81
82
Unborn {
82
- /// The path of the ref the symbolic ref points to, like `refs/heads/main`.
83
+ /// The name at which the ref is located, typically `HEAD`.
84
+ full_ref_name : BString ,
85
+ /// The path of the ref the symbolic ref points to, like `refs/heads/main`, even though the `target` does not yet exist.
83
86
target : BString ,
84
87
} ,
85
88
}
@@ -100,7 +103,10 @@ impl Ref {
100
103
tag : object,
101
104
object : peeled,
102
105
} => ( full_ref_name. as_ref ( ) , Some ( object) , Some ( peeled) ) ,
103
- Ref :: Unborn { target : _ } => ( "HEAD" . into ( ) , None , None ) ,
106
+ Ref :: Unborn {
107
+ full_ref_name,
108
+ target : _,
109
+ } => ( full_ref_name. as_ref ( ) , None , None ) ,
104
110
}
105
111
}
106
112
}
Original file line number Diff line number Diff line change @@ -207,7 +207,10 @@ pub(in crate::fetch::refs) fn parse_v2(line: &str) -> Result<Ref, Error> {
207
207
object : id,
208
208
target : name. into ( ) ,
209
209
} ,
210
- None => Ref :: Unborn { target : name. into ( ) } ,
210
+ None => Ref :: Unborn {
211
+ full_ref_name : path. into ( ) ,
212
+ target : name. into ( ) ,
213
+ } ,
211
214
} ,
212
215
} ,
213
216
_ => {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ async fn extract_references_from_v2_refs() {
8
8
let input = & mut "808e50d724f604f69ab93c6da2919c014667bedb HEAD symref-target:refs/heads/main
9
9
808e50d724f604f69ab93c6da2919c014667bedb MISSING_NAMESPACE_TARGET symref-target:(null)
10
10
unborn HEAD symref-target:refs/heads/main
11
+ unborn refs/heads/symbolic symref-target:refs/heads/target
11
12
808e50d724f604f69ab93c6da2919c014667bedb refs/heads/main
12
13
7fe1b98b39423b71e14217aa299a03b7c937d656 refs/tags/foo peeled:808e50d724f604f69ab93c6da2919c014667bedb
13
14
7fe1b98b39423b71e14217aa299a03b7c937d6ff refs/tags/blaz
@@ -29,8 +30,13 @@ unborn HEAD symref-target:refs/heads/main
29
30
object: oid( "808e50d724f604f69ab93c6da2919c014667bedb" )
30
31
} ,
31
32
Ref :: Unborn {
33
+ full_ref_name: "HEAD" . into( ) ,
32
34
target: "refs/heads/main" . into( ) ,
33
35
} ,
36
+ Ref :: Unborn {
37
+ full_ref_name: "refs/heads/symbolic" . into( ) ,
38
+ target: "refs/heads/target" . into( ) ,
39
+ } ,
34
40
Ref :: Direct {
35
41
full_ref_name: "refs/heads/main" . into( ) ,
36
42
object: oid( "808e50d724f604f69ab93c6da2919c014667bedb" )
You can’t perform that action at this time.
0 commit comments