@@ -63,12 +63,10 @@ enum SourceKind {
6363pub enum GitReference {
6464 /// From a tag.
6565 Tag ( String ) ,
66- /// From a branch.
66+ /// From the HEAD of a branch.
6767 Branch ( String ) ,
6868 /// From a specific revision.
6969 Rev ( String ) ,
70- /// The default branch of the repository, the reference named `HEAD`.
71- DefaultBranch ,
7270}
7371
7472impl SourceId {
@@ -116,7 +114,7 @@ impl SourceId {
116114 match kind {
117115 "git" => {
118116 let mut url = url. into_url ( ) ?;
119- let mut reference = GitReference :: DefaultBranch ;
117+ let mut reference = GitReference :: Branch ( "master" . to_string ( ) ) ;
120118 for ( k, v) in url. query_pairs ( ) {
121119 match & k[ ..] {
122120 // Map older 'ref' to branch.
@@ -551,10 +549,10 @@ impl<'a> fmt::Display for SourceIdIntoUrl<'a> {
551549
552550impl GitReference {
553551 /// Returns a `Display`able view of this git reference, or None if using
554- /// the head of the default branch
552+ /// the head of the "master" branch
555553 pub fn pretty_ref ( & self ) -> Option < PrettyRef < ' _ > > {
556554 match * self {
557- GitReference :: DefaultBranch => None ,
555+ GitReference :: Branch ( ref s ) if * s == "master" => None ,
558556 _ => Some ( PrettyRef { inner : self } ) ,
559557 }
560558 }
@@ -571,7 +569,6 @@ impl<'a> fmt::Display for PrettyRef<'a> {
571569 GitReference :: Branch ( ref b) => write ! ( f, "branch={}" , b) ,
572570 GitReference :: Tag ( ref s) => write ! ( f, "tag={}" , s) ,
573571 GitReference :: Rev ( ref s) => write ! ( f, "rev={}" , s) ,
574- GitReference :: DefaultBranch => unreachable ! ( ) ,
575572 }
576573 }
577574}
@@ -584,11 +581,11 @@ mod tests {
584581 #[ test]
585582 fn github_sources_equal ( ) {
586583 let loc = "https://github.com/foo/bar" . into_url ( ) . unwrap ( ) ;
587- let default = SourceKind :: Git ( GitReference :: DefaultBranch ) ;
588- let s1 = SourceId :: new ( default . clone ( ) , loc) . unwrap ( ) ;
584+ let master = SourceKind :: Git ( GitReference :: Branch ( "master" . to_string ( ) ) ) ;
585+ let s1 = SourceId :: new ( master . clone ( ) , loc) . unwrap ( ) ;
589586
590587 let loc = "git://github.com/foo/bar" . into_url ( ) . unwrap ( ) ;
591- let s2 = SourceId :: new ( default , loc. clone ( ) ) . unwrap ( ) ;
588+ let s2 = SourceId :: new ( master , loc. clone ( ) ) . unwrap ( ) ;
592589
593590 assert_eq ! ( s1, s2) ;
594591
0 commit comments