diff options
Diffstat (limited to 'src/git.rs')
-rw-r--r-- | src/git.rs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -44,6 +44,7 @@ pub fn mirror<P: AsRef<Path>>( url: &str, path: P, description: &str, + default_branch: &str, ) -> Result<(), Error> { let repo = git2::Repository::init_opts( path, @@ -74,6 +75,12 @@ pub fn mirror<P: AsRef<Path>>( let refspecs: [&str; 0] = []; remote.fetch(&refspecs, None, None)?; + if default_branch != "master" { + repo.set_head( + &format!("refs/heads/{}", default_branch), + )?; + } + Ok(()) } |