@@ -68,8 +68,6 @@ use url::Url;
68
68
pub struct GitSource < ' cfg > {
69
69
/// The git remote which we're going to fetch from.
70
70
remote : GitRemote ,
71
- /// The Git reference from the manifest file.
72
- manifest_reference : GitReference ,
73
71
/// The revision which a git source is locked to.
74
72
///
75
73
/// Expected to always be [`Revision::Locked`] after the Git repository is fetched.
@@ -103,7 +101,7 @@ impl<'cfg> GitSource<'cfg> {
103
101
assert ! ( source_id. is_git( ) , "id is not git, id={}" , source_id) ;
104
102
105
103
let remote = GitRemote :: new ( source_id. url ( ) ) ;
106
- let manifest_reference = source_id . git_reference ( ) . unwrap ( ) . clone ( ) ;
104
+ // Fallback to git ref from mainfest if there is no locked revision.
107
105
let locked_rev = source_id
108
106
. precise_full_git_fragment ( )
109
107
. map ( |s| Revision :: new ( s. into ( ) ) )
@@ -119,7 +117,6 @@ impl<'cfg> GitSource<'cfg> {
119
117
120
118
let source = GitSource {
121
119
remote,
122
- manifest_reference,
123
120
locked_rev,
124
121
source_id,
125
122
path_source : None ,
@@ -239,9 +236,12 @@ impl<'cfg> Debug for GitSource<'cfg> {
239
236
// TODO(-Znext-lockfile-bump): set it to true when stabilizing
240
237
// lockfile v4, because we want Source ID serialization to be
241
238
// consistent with lockfile.
242
- match self . manifest_reference . pretty_ref ( false ) {
243
- Some ( s) => write ! ( f, " ({})" , s) ,
244
- None => Ok ( ( ) ) ,
239
+ match & self . locked_rev {
240
+ Revision :: Deferred ( git_ref) => match git_ref. pretty_ref ( false ) {
241
+ Some ( s) => write ! ( f, " ({})" , s) ,
242
+ None => Ok ( ( ) ) ,
243
+ } ,
244
+ Revision :: Locked ( oid) => write ! ( f, " ({oid})" ) ,
245
245
}
246
246
}
247
247
}
0 commit comments