@@ -1463,7 +1463,7 @@ impl Repository {
14631463
14641464 /// Lookup a reference to one of the objects in a repository.
14651465 /// `Repository::find_reference` with teeth; give the method your reference in
1466- /// human-readable format e.g. 'master ' instead of 'refs/heads/master ', and it
1466+ /// human-readable format e.g. 'main ' instead of 'refs/heads/main ', and it
14671467 /// will do-what-you-mean, returning the `Reference`.
14681468 pub fn resolve_reference_from_short_name ( & self , refname : & str ) -> Result < Reference < ' _ > , Error > {
14691469 let refname = CString :: new ( refname) ?;
@@ -2929,9 +2929,9 @@ impl RepositoryInitOptions {
29292929
29302930 /// The name of the head to point HEAD at.
29312931 ///
2932- /// If not configured, this will be treated as `master` and the HEAD ref
2933- /// will be set to `refs/heads/master`. If this begins with `refs/` it will
2934- /// be used verbatim; otherwise `refs/heads/` will be prefixed
2932+ /// If not configured, this will be taken from your git configuration.
2933+ /// If this begins with `refs/` it will be used verbatim;
2934+ /// otherwise `refs/heads/` will be prefixed
29352935 pub fn initial_head ( & mut self , head : & str ) -> & mut RepositoryInitOptions {
29362936 self . initial_head = Some ( CString :: new ( head) . unwrap ( ) ) ;
29372937 self
@@ -3160,11 +3160,11 @@ mod tests {
31603160 let ( _td, repo) = crate :: test:: repo_init ( ) ;
31613161
31623162 assert_eq ! ( repo. reference_has_log( "HEAD" ) . unwrap( ) , true ) ;
3163- assert_eq ! ( repo. reference_has_log( "refs/heads/master " ) . unwrap( ) , true ) ;
3163+ assert_eq ! ( repo. reference_has_log( "refs/heads/main " ) . unwrap( ) , true ) ;
31643164 assert_eq ! ( repo. reference_has_log( "NOT_HEAD" ) . unwrap( ) , false ) ;
3165- let master_oid = repo. revparse_single ( "master " ) . unwrap ( ) . id ( ) ;
3165+ let main_oid = repo. revparse_single ( "main " ) . unwrap ( ) . id ( ) ;
31663166 assert ! ( repo
3167- . reference( "NOT_HEAD" , master_oid , false , "creating a new branch" )
3167+ . reference( "NOT_HEAD" , main_oid , false , "creating a new branch" )
31683168 . is_ok( ) ) ;
31693169 assert_eq ! ( repo. reference_has_log( "NOT_HEAD" ) . unwrap( ) , false ) ;
31703170 assert ! ( repo. reference_ensure_log( "NOT_HEAD" ) . is_ok( ) ) ;
@@ -3178,7 +3178,7 @@ mod tests {
31783178 assert ! ( repo. set_head( "refs/heads/does-not-exist" ) . is_ok( ) ) ;
31793179 assert ! ( repo. head( ) . is_err( ) ) ;
31803180
3181- assert ! ( repo. set_head( "refs/heads/master " ) . is_ok( ) ) ;
3181+ assert ! ( repo. set_head( "refs/heads/main " ) . is_ok( ) ) ;
31823182 assert ! ( repo. head( ) . is_ok( ) ) ;
31833183
31843184 assert ! ( repo. set_head( "*" ) . is_err( ) ) ;
@@ -3191,9 +3191,9 @@ mod tests {
31913191 let void_oid = Oid :: from_bytes ( b"00000000000000000000" ) . unwrap ( ) ;
31923192 assert ! ( repo. set_head_detached( void_oid) . is_err( ) ) ;
31933193
3194- let master_oid = repo. revparse_single ( "master " ) . unwrap ( ) . id ( ) ;
3195- assert ! ( repo. set_head_detached( master_oid ) . is_ok( ) ) ;
3196- assert_eq ! ( repo. head( ) . unwrap( ) . target( ) . unwrap( ) , master_oid ) ;
3194+ let main_oid = repo. revparse_single ( "main " ) . unwrap ( ) . id ( ) ;
3195+ assert ! ( repo. set_head_detached( main_oid ) . is_ok( ) ) ;
3196+ assert_eq ! ( repo. head( ) . unwrap( ) . target( ) . unwrap( ) , main_oid ) ;
31973197 }
31983198
31993199 /// create the following:
@@ -3425,8 +3425,8 @@ mod tests {
34253425 let ( _td, repo) = graph_repo_init ( ) ;
34263426
34273427 {
3428- let short_refname = "master " ;
3429- let expected_refname = "refs/heads/master " ;
3428+ let short_refname = "main " ;
3429+ let expected_refname = "refs/heads/main " ;
34303430 let ( obj, reference) = repo. revparse_ext ( short_refname) . unwrap ( ) ;
34313431 let expected_obj = repo. revparse_single ( expected_refname) . unwrap ( ) ;
34323432 assert_eq ! ( obj. id( ) , expected_obj. id( ) ) ;
0 commit comments